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

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

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.containerregistry.models.ProvisioningState;
import com.azure.resourcemanager.containerregistry.models.TokenCredentialsProperties;
import com.azure.resourcemanager.containerregistry.models.TokenStatus;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** The properties of a token. */
@Fluent
public final class TokenProperties {
    /*
     * The creation date of scope map.
     */
    @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime creationDate;

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

    /*
     * The resource ID of the scope map to which the token will be associated with.
     */
    @JsonProperty(value = "scopeMapId")
    private String scopeMapId;

    /*
     * The credentials that can be used for authenticating the token.
     */
    @JsonProperty(value = "credentials")
    private TokenCredentialsProperties credentials;

    /*
     * The status of the token example enabled or disabled.
     */
    @JsonProperty(value = "status")
    private TokenStatus status;

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

    /**
     * Get the creationDate property: The creation date of scope map.
     *
     * @return the creationDate value.
     */
    public OffsetDateTime creationDate() {
        return this.creationDate;
    }

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

    /**
     * Get the scopeMapId property: The resource ID of the scope map to which the token will be associated with.
     *
     * @return the scopeMapId value.
     */
    public String scopeMapId() {
        return this.scopeMapId;
    }

    /**
     * Set the scopeMapId property: The resource ID of the scope map to which the token will be associated with.
     *
     * @param scopeMapId the scopeMapId value to set.
     * @return the TokenProperties object itself.
     */
    public TokenProperties withScopeMapId(String scopeMapId) {
        this.scopeMapId = scopeMapId;
        return this;
    }

    /**
     * Get the credentials property: The credentials that can be used for authenticating the token.
     *
     * @return the credentials value.
     */
    public TokenCredentialsProperties credentials() {
        return this.credentials;
    }

    /**
     * Set the credentials property: The credentials that can be used for authenticating the token.
     *
     * @param credentials the credentials value to set.
     * @return the TokenProperties object itself.
     */
    public TokenProperties withCredentials(TokenCredentialsProperties credentials) {
        this.credentials = credentials;
        return this;
    }

    /**
     * Get the status property: The status of the token example enabled or disabled.
     *
     * @return the status value.
     */
    public TokenStatus status() {
        return this.status;
    }

    /**
     * Set the status property: The status of the token example enabled or disabled.
     *
     * @param status the status value to set.
     * @return the TokenProperties object itself.
     */
    public TokenProperties withStatus(TokenStatus status) {
        this.status = status;
        return this;
    }

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