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

package com.azure.resourcemanager.paloaltonetworks.ngfw.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.BooleanEnum;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;

/** certificate used for inbound and outbound decryption. */
@Fluent
public final class CertificateObject {
    /*
     * Resource Id of certificate signer, to be populated only when certificateSelfSigned is false
     */
    @JsonProperty(value = "certificateSignerResourceId")
    private String certificateSignerResourceId;

    /*
     * use certificate self signed
     */
    @JsonProperty(value = "certificateSelfSigned", required = true)
    private BooleanEnum certificateSelfSigned;

    /*
     * comment for this object
     */
    @JsonProperty(value = "auditComment")
    private String auditComment;

    /*
     * user description for this object
     */
    @JsonProperty(value = "description")
    private String description;

    /*
     * read only string representing last create or update
     */
    @JsonProperty(value = "etag")
    private String etag;

    /*
     * Provisioning state of the resource.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

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

    /**
     * Get the certificateSignerResourceId property: Resource Id of certificate signer, to be populated only when
     * certificateSelfSigned is false.
     *
     * @return the certificateSignerResourceId value.
     */
    public String certificateSignerResourceId() {
        return this.certificateSignerResourceId;
    }

    /**
     * Set the certificateSignerResourceId property: Resource Id of certificate signer, to be populated only when
     * certificateSelfSigned is false.
     *
     * @param certificateSignerResourceId the certificateSignerResourceId value to set.
     * @return the CertificateObject object itself.
     */
    public CertificateObject withCertificateSignerResourceId(String certificateSignerResourceId) {
        this.certificateSignerResourceId = certificateSignerResourceId;
        return this;
    }

    /**
     * Get the certificateSelfSigned property: use certificate self signed.
     *
     * @return the certificateSelfSigned value.
     */
    public BooleanEnum certificateSelfSigned() {
        return this.certificateSelfSigned;
    }

    /**
     * Set the certificateSelfSigned property: use certificate self signed.
     *
     * @param certificateSelfSigned the certificateSelfSigned value to set.
     * @return the CertificateObject object itself.
     */
    public CertificateObject withCertificateSelfSigned(BooleanEnum certificateSelfSigned) {
        this.certificateSelfSigned = certificateSelfSigned;
        return this;
    }

    /**
     * Get the auditComment property: comment for this object.
     *
     * @return the auditComment value.
     */
    public String auditComment() {
        return this.auditComment;
    }

    /**
     * Set the auditComment property: comment for this object.
     *
     * @param auditComment the auditComment value to set.
     * @return the CertificateObject object itself.
     */
    public CertificateObject withAuditComment(String auditComment) {
        this.auditComment = auditComment;
        return this;
    }

    /**
     * Get the description property: user description for this object.
     *
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: user description for this object.
     *
     * @param description the description value to set.
     * @return the CertificateObject object itself.
     */
    public CertificateObject withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the etag property: read only string representing last create or update.
     *
     * @return the etag value.
     */
    public String etag() {
        return this.etag;
    }

    /**
     * Set the etag property: read only string representing last create or update.
     *
     * @param etag the etag value to set.
     * @return the CertificateObject object itself.
     */
    public CertificateObject withEtag(String etag) {
        this.etag = etag;
        return this;
    }

    /**
     * Get the provisioningState property: Provisioning state of the resource.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

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

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