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

package com.azure.resourcemanager.machinelearning.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The RegenerateEndpointKeysRequest model. */
@Fluent
public final class RegenerateEndpointKeysRequest {
    /*
     * [Required] Specification for which type of key to generate. Primary or Secondary.
     */
    @JsonProperty(value = "keyType", required = true)
    private KeyType keyType;

    /*
     * The value the key is set to.
     */
    @JsonProperty(value = "keyValue")
    private String keyValue;

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

    /**
     * Get the keyType property: [Required] Specification for which type of key to generate. Primary or Secondary.
     *
     * @return the keyType value.
     */
    public KeyType keyType() {
        return this.keyType;
    }

    /**
     * Set the keyType property: [Required] Specification for which type of key to generate. Primary or Secondary.
     *
     * @param keyType the keyType value to set.
     * @return the RegenerateEndpointKeysRequest object itself.
     */
    public RegenerateEndpointKeysRequest withKeyType(KeyType keyType) {
        this.keyType = keyType;
        return this;
    }

    /**
     * Get the keyValue property: The value the key is set to.
     *
     * @return the keyValue value.
     */
    public String keyValue() {
        return this.keyValue;
    }

    /**
     * Set the keyValue property: The value the key is set to.
     *
     * @param keyValue the keyValue value to set.
     * @return the RegenerateEndpointKeysRequest object itself.
     */
    public RegenerateEndpointKeysRequest withKeyValue(String keyValue) {
        this.keyValue = keyValue;
        return this;
    }

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

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