// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.recoveryservices.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.time.OffsetDateTime;

/** Certificate details representing the Vault credentials for ACS. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "authType")
@JsonTypeName("AccessControlService")
@Fluent
public final class ResourceCertificateAndAcsDetails extends ResourceCertificateDetails {
    /*
     * ACS namespace name - tenant for our service.
     */
    @JsonProperty(value = "globalAcsNamespace", required = true)
    private String globalAcsNamespace;

    /*
     * Acs mgmt host name to connect to.
     */
    @JsonProperty(value = "globalAcsHostName", required = true)
    private String globalAcsHostname;

    /*
     * Global ACS namespace RP realm.
     */
    @JsonProperty(value = "globalAcsRPRealm", required = true)
    private String globalAcsRPRealm;

    /** Creates an instance of ResourceCertificateAndAcsDetails class. */
    public ResourceCertificateAndAcsDetails() {
    }

    /**
     * Get the globalAcsNamespace property: ACS namespace name - tenant for our service.
     *
     * @return the globalAcsNamespace value.
     */
    public String globalAcsNamespace() {
        return this.globalAcsNamespace;
    }

    /**
     * Set the globalAcsNamespace property: ACS namespace name - tenant for our service.
     *
     * @param globalAcsNamespace the globalAcsNamespace value to set.
     * @return the ResourceCertificateAndAcsDetails object itself.
     */
    public ResourceCertificateAndAcsDetails withGlobalAcsNamespace(String globalAcsNamespace) {
        this.globalAcsNamespace = globalAcsNamespace;
        return this;
    }

    /**
     * Get the globalAcsHostname property: Acs mgmt host name to connect to.
     *
     * @return the globalAcsHostname value.
     */
    public String globalAcsHostname() {
        return this.globalAcsHostname;
    }

    /**
     * Set the globalAcsHostname property: Acs mgmt host name to connect to.
     *
     * @param globalAcsHostname the globalAcsHostname value to set.
     * @return the ResourceCertificateAndAcsDetails object itself.
     */
    public ResourceCertificateAndAcsDetails withGlobalAcsHostname(String globalAcsHostname) {
        this.globalAcsHostname = globalAcsHostname;
        return this;
    }

    /**
     * Get the globalAcsRPRealm property: Global ACS namespace RP realm.
     *
     * @return the globalAcsRPRealm value.
     */
    public String globalAcsRPRealm() {
        return this.globalAcsRPRealm;
    }

    /**
     * Set the globalAcsRPRealm property: Global ACS namespace RP realm.
     *
     * @param globalAcsRPRealm the globalAcsRPRealm value to set.
     * @return the ResourceCertificateAndAcsDetails object itself.
     */
    public ResourceCertificateAndAcsDetails withGlobalAcsRPRealm(String globalAcsRPRealm) {
        this.globalAcsRPRealm = globalAcsRPRealm;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ResourceCertificateAndAcsDetails withCertificate(byte[] certificate) {
        super.withCertificate(certificate);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ResourceCertificateAndAcsDetails withFriendlyName(String friendlyName) {
        super.withFriendlyName(friendlyName);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ResourceCertificateAndAcsDetails withIssuer(String issuer) {
        super.withIssuer(issuer);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ResourceCertificateAndAcsDetails withResourceId(Long resourceId) {
        super.withResourceId(resourceId);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ResourceCertificateAndAcsDetails withSubject(String subject) {
        super.withSubject(subject);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ResourceCertificateAndAcsDetails withThumbprint(String thumbprint) {
        super.withThumbprint(thumbprint);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ResourceCertificateAndAcsDetails withValidFrom(OffsetDateTime validFrom) {
        super.withValidFrom(validFrom);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ResourceCertificateAndAcsDetails withValidTo(OffsetDateTime validTo) {
        super.withValidTo(validTo);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (globalAcsNamespace() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property globalAcsNamespace in model ResourceCertificateAndAcsDetails"));
        }
        if (globalAcsHostname() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property globalAcsHostname in model ResourceCertificateAndAcsDetails"));
        }
        if (globalAcsRPRealm() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property globalAcsRPRealm in model ResourceCertificateAndAcsDetails"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(ResourceCertificateAndAcsDetails.class);
}
