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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.policyinsights.models.AttestationEvidence;
import com.azure.resourcemanager.policyinsights.models.ComplianceState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;

/** An attestation resource. */
@Fluent
public final class AttestationInner extends ProxyResource {
    /*
     * Properties for the attestation.
     */
    @JsonProperty(value = "properties", required = true)
    private AttestationProperties innerProperties = new AttestationProperties();

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

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

    /**
     * Get the innerProperties property: Properties for the attestation.
     *
     * @return the innerProperties value.
     */
    private AttestationProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the policyAssignmentId property: The resource ID of the policy assignment that the attestation is setting the
     * state for.
     *
     * @return the policyAssignmentId value.
     */
    public String policyAssignmentId() {
        return this.innerProperties() == null ? null : this.innerProperties().policyAssignmentId();
    }

    /**
     * Set the policyAssignmentId property: The resource ID of the policy assignment that the attestation is setting the
     * state for.
     *
     * @param policyAssignmentId the policyAssignmentId value to set.
     * @return the AttestationInner object itself.
     */
    public AttestationInner withPolicyAssignmentId(String policyAssignmentId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AttestationProperties();
        }
        this.innerProperties().withPolicyAssignmentId(policyAssignmentId);
        return this;
    }

    /**
     * Get the policyDefinitionReferenceId property: The policy definition reference ID from a policy set definition
     * that the attestation is setting the state for. If the policy assignment assigns a policy set definition the
     * attestation can choose a definition within the set definition with this property or omit this and set the state
     * for the entire set definition.
     *
     * @return the policyDefinitionReferenceId value.
     */
    public String policyDefinitionReferenceId() {
        return this.innerProperties() == null ? null : this.innerProperties().policyDefinitionReferenceId();
    }

    /**
     * Set the policyDefinitionReferenceId property: The policy definition reference ID from a policy set definition
     * that the attestation is setting the state for. If the policy assignment assigns a policy set definition the
     * attestation can choose a definition within the set definition with this property or omit this and set the state
     * for the entire set definition.
     *
     * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set.
     * @return the AttestationInner object itself.
     */
    public AttestationInner withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AttestationProperties();
        }
        this.innerProperties().withPolicyDefinitionReferenceId(policyDefinitionReferenceId);
        return this;
    }

    /**
     * Get the complianceState property: The compliance state that should be set on the resource.
     *
     * @return the complianceState value.
     */
    public ComplianceState complianceState() {
        return this.innerProperties() == null ? null : this.innerProperties().complianceState();
    }

    /**
     * Set the complianceState property: The compliance state that should be set on the resource.
     *
     * @param complianceState the complianceState value to set.
     * @return the AttestationInner object itself.
     */
    public AttestationInner withComplianceState(ComplianceState complianceState) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AttestationProperties();
        }
        this.innerProperties().withComplianceState(complianceState);
        return this;
    }

    /**
     * Get the expiresOn property: The time the compliance state should expire.
     *
     * @return the expiresOn value.
     */
    public OffsetDateTime expiresOn() {
        return this.innerProperties() == null ? null : this.innerProperties().expiresOn();
    }

    /**
     * Set the expiresOn property: The time the compliance state should expire.
     *
     * @param expiresOn the expiresOn value to set.
     * @return the AttestationInner object itself.
     */
    public AttestationInner withExpiresOn(OffsetDateTime expiresOn) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AttestationProperties();
        }
        this.innerProperties().withExpiresOn(expiresOn);
        return this;
    }

    /**
     * Get the owner property: The person responsible for setting the state of the resource. This value is typically an
     * Azure Active Directory object ID.
     *
     * @return the owner value.
     */
    public String owner() {
        return this.innerProperties() == null ? null : this.innerProperties().owner();
    }

    /**
     * Set the owner property: The person responsible for setting the state of the resource. This value is typically an
     * Azure Active Directory object ID.
     *
     * @param owner the owner value to set.
     * @return the AttestationInner object itself.
     */
    public AttestationInner withOwner(String owner) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AttestationProperties();
        }
        this.innerProperties().withOwner(owner);
        return this;
    }

    /**
     * Get the comments property: Comments describing why this attestation was created.
     *
     * @return the comments value.
     */
    public String comments() {
        return this.innerProperties() == null ? null : this.innerProperties().comments();
    }

    /**
     * Set the comments property: Comments describing why this attestation was created.
     *
     * @param comments the comments value to set.
     * @return the AttestationInner object itself.
     */
    public AttestationInner withComments(String comments) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AttestationProperties();
        }
        this.innerProperties().withComments(comments);
        return this;
    }

    /**
     * Get the evidence property: The evidence supporting the compliance state set in this attestation.
     *
     * @return the evidence value.
     */
    public List<AttestationEvidence> evidence() {
        return this.innerProperties() == null ? null : this.innerProperties().evidence();
    }

    /**
     * Set the evidence property: The evidence supporting the compliance state set in this attestation.
     *
     * @param evidence the evidence value to set.
     * @return the AttestationInner object itself.
     */
    public AttestationInner withEvidence(List<AttestationEvidence> evidence) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AttestationProperties();
        }
        this.innerProperties().withEvidence(evidence);
        return this;
    }

    /**
     * Get the provisioningState property: The status of the attestation.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the lastComplianceStateChangeAt property: The time the compliance state was last changed in this attestation.
     *
     * @return the lastComplianceStateChangeAt value.
     */
    public OffsetDateTime lastComplianceStateChangeAt() {
        return this.innerProperties() == null ? null : this.innerProperties().lastComplianceStateChangeAt();
    }

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

    /**
     * Set the assessmentDate property: The time the evidence was assessed.
     *
     * @param assessmentDate the assessmentDate value to set.
     * @return the AttestationInner object itself.
     */
    public AttestationInner withAssessmentDate(OffsetDateTime assessmentDate) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AttestationProperties();
        }
        this.innerProperties().withAssessmentDate(assessmentDate);
        return this;
    }

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

    /**
     * Set the metadata property: Additional metadata for this attestation.
     *
     * @param metadata the metadata value to set.
     * @return the AttestationInner object itself.
     */
    public AttestationInner withMetadata(Object metadata) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AttestationProperties();
        }
        this.innerProperties().withMetadata(metadata);
        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 AttestationInner"));
        } else {
            innerProperties().validate();
        }
    }

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