// 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.resourcemanager.apimanagement.models.KeyVaultContractProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** Certificate details. */
@Fluent
public final class CertificateContractInner extends ProxyResource {
    /*
     * Certificate properties details.
     */
    @JsonProperty(value = "properties")
    private CertificateContractProperties innerProperties;

    /**
     * Get the innerProperties property: Certificate properties details.
     *
     * @return the innerProperties value.
     */
    private CertificateContractProperties innerProperties() {
        return this.innerProperties;
    }

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

    /**
     * Set the subject property: Subject attribute of the certificate.
     *
     * @param subject the subject value to set.
     * @return the CertificateContractInner object itself.
     */
    public CertificateContractInner withSubject(String subject) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CertificateContractProperties();
        }
        this.innerProperties().withSubject(subject);
        return this;
    }

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

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

    /**
     * Get the expirationDate 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 expirationDate value.
     */
    public OffsetDateTime expirationDate() {
        return this.innerProperties() == null ? null : this.innerProperties().expirationDate();
    }

    /**
     * Set the expirationDate 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 expirationDate the expirationDate value to set.
     * @return the CertificateContractInner object itself.
     */
    public CertificateContractInner withExpirationDate(OffsetDateTime expirationDate) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CertificateContractProperties();
        }
        this.innerProperties().withExpirationDate(expirationDate);
        return this;
    }

    /**
     * Get the keyVault property: KeyVault location details of the certificate.
     *
     * @return the keyVault value.
     */
    public KeyVaultContractProperties keyVault() {
        return this.innerProperties() == null ? null : this.innerProperties().keyVault();
    }

    /**
     * Set the keyVault property: KeyVault location details of the certificate.
     *
     * @param keyVault the keyVault value to set.
     * @return the CertificateContractInner object itself.
     */
    public CertificateContractInner withKeyVault(KeyVaultContractProperties keyVault) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CertificateContractProperties();
        }
        this.innerProperties().withKeyVault(keyVault);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }
}
