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

package com.azure.resourcemanager.maps.models;

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

/** Whether the operation refers to the primary or secondary key. */
@Fluent
public final class MapsKeySpecification {
    /*
     * Whether the operation refers to the primary or secondary key.
     */
    @JsonProperty(value = "keyType", required = true)
    private KeyType keyType;

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

    /**
     * Get the keyType property: Whether the operation refers to the primary or secondary key.
     *
     * @return the keyType value.
     */
    public KeyType keyType() {
        return this.keyType;
    }

    /**
     * Set the keyType property: Whether the operation refers to the primary or secondary key.
     *
     * @param keyType the keyType value to set.
     * @return the MapsKeySpecification object itself.
     */
    public MapsKeySpecification withKeyType(KeyType keyType) {
        this.keyType = keyType;
        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 MapsKeySpecification"));
        }
    }

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