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

package com.azure.resourcemanager.logic.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.logic.models.KeyVaultKeyReference;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.Map;

/** The integration account certificate. */
@Fluent
public final class IntegrationAccountCertificateInner extends Resource {
    /*
     * The integration account certificate properties.
     */
    @JsonProperty(value = "properties", required = true)
    private IntegrationAccountCertificateProperties innerProperties = new IntegrationAccountCertificateProperties();

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

    /**
     * Get the innerProperties property: The integration account certificate properties.
     *
     * @return the innerProperties value.
     */
    private IntegrationAccountCertificateProperties innerProperties() {
        return this.innerProperties;
    }

    /** {@inheritDoc} */
    @Override
    public IntegrationAccountCertificateInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public IntegrationAccountCertificateInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the createdTime property: The created time.
     *
     * @return the createdTime value.
     */
    public OffsetDateTime createdTime() {
        return this.innerProperties() == null ? null : this.innerProperties().createdTime();
    }

    /**
     * Get the changedTime property: The changed time.
     *
     * @return the changedTime value.
     */
    public OffsetDateTime changedTime() {
        return this.innerProperties() == null ? null : this.innerProperties().changedTime();
    }

    /**
     * Get the metadata property: The metadata.
     *
     * @return the metadata value.
     */
    public Object metadata() {
        return this.innerProperties() == null ? null : this.innerProperties().metadata();
    }

    /**
     * Set the metadata property: The metadata.
     *
     * @param metadata the metadata value to set.
     * @return the IntegrationAccountCertificateInner object itself.
     */
    public IntegrationAccountCertificateInner withMetadata(Object metadata) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IntegrationAccountCertificateProperties();
        }
        this.innerProperties().withMetadata(metadata);
        return this;
    }

    /**
     * Get the key property: The key details in the key vault.
     *
     * @return the key value.
     */
    public KeyVaultKeyReference key() {
        return this.innerProperties() == null ? null : this.innerProperties().key();
    }

    /**
     * Set the key property: The key details in the key vault.
     *
     * @param key the key value to set.
     * @return the IntegrationAccountCertificateInner object itself.
     */
    public IntegrationAccountCertificateInner withKey(KeyVaultKeyReference key) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IntegrationAccountCertificateProperties();
        }
        this.innerProperties().withKey(key);
        return this;
    }

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

    /**
     * Set the publicCertificate property: The public certificate.
     *
     * @param publicCertificate the publicCertificate value to set.
     * @return the IntegrationAccountCertificateInner object itself.
     */
    public IntegrationAccountCertificateInner withPublicCertificate(String publicCertificate) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IntegrationAccountCertificateProperties();
        }
        this.innerProperties().withPublicCertificate(publicCertificate);
        return this;
    }

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

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