// 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.resourcemanager.apimanagement.fluent.models.UserTokenParameterProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** Get User Token parameters. */
@Fluent
public final class UserTokenParameters {
    /*
     * User Token Parameter contract properties.
     */
    @JsonProperty(value = "properties")
    private UserTokenParameterProperties innerProperties;

    /**
     * Get the innerProperties property: User Token Parameter contract properties.
     *
     * @return the innerProperties value.
     */
    private UserTokenParameterProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the keyType property: The Key to be used to generate token for user.
     *
     * @return the keyType value.
     */
    public KeyType keyType() {
        return this.innerProperties() == null ? null : this.innerProperties().keyType();
    }

    /**
     * Set the keyType property: The Key to be used to generate token for user.
     *
     * @param keyType the keyType value to set.
     * @return the UserTokenParameters object itself.
     */
    public UserTokenParameters withKeyType(KeyType keyType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UserTokenParameterProperties();
        }
        this.innerProperties().withKeyType(keyType);
        return this;
    }

    /**
     * Get the expiry property: The Expiry time of the Token. Maximum token expiry time is set to 30 days. 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.innerProperties() == null ? null : this.innerProperties().expiry();
    }

    /**
     * Set the expiry property: The Expiry time of the Token. Maximum token expiry time is set to 30 days. 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 UserTokenParameters object itself.
     */
    public UserTokenParameters withExpiry(OffsetDateTime expiry) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UserTokenParameterProperties();
        }
        this.innerProperties().withExpiry(expiry);
        return this;
    }

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