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

package com.azure.resourcemanager.apimanagement.models;

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

/** SSL certificate information. */
@Fluent
public final class CertificateInformation {
    /*
     * Expiration date of the certificate. The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as
     * specified by the ISO 8601 standard.
     */
    @JsonProperty(value = "expiry", required = true)
    private OffsetDateTime expiry;

    /*
     * Thumbprint of the certificate.
     */
    @JsonProperty(value = "thumbprint", required = true)
    private String thumbprint;

    /*
     * Subject of the certificate.
     */
    @JsonProperty(value = "subject", required = true)
    private String subject;

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

    /**
     * Get the expiry property: Expiration date of the certificate. The date conforms to the following format:
     * `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
     *
     * @return the expiry value.
     */
    public OffsetDateTime expiry() {
        return this.expiry;
    }

    /**
     * Set the expiry property: Expiration date of the certificate. The date conforms to the following format:
     * `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard.
     *
     * @param expiry the expiry value to set.
     * @return the CertificateInformation object itself.
     */
    public CertificateInformation withExpiry(OffsetDateTime expiry) {
        this.expiry = expiry;
        return this;
    }

    /**
     * Get the thumbprint property: Thumbprint of the certificate.
     *
     * @return the thumbprint value.
     */
    public String thumbprint() {
        return this.thumbprint;
    }

    /**
     * Set the thumbprint property: Thumbprint of the certificate.
     *
     * @param thumbprint the thumbprint value to set.
     * @return the CertificateInformation object itself.
     */
    public CertificateInformation withThumbprint(String thumbprint) {
        this.thumbprint = thumbprint;
        return this;
    }

    /**
     * Get the subject property: Subject of the certificate.
     *
     * @return the subject value.
     */
    public String subject() {
        return this.subject;
    }

    /**
     * Set the subject property: Subject of the certificate.
     *
     * @param subject the subject value to set.
     * @return the CertificateInformation object itself.
     */
    public CertificateInformation withSubject(String subject) {
        this.subject = subject;
        return this;
    }

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

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