// 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.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** API Management service resource SKU properties. */
@Fluent
public final class ApiManagementServiceSkuProperties {
    /*
     * Name of the Sku.
     */
    @JsonProperty(value = "name", required = true)
    private SkuType name;

    /*
     * Capacity of the SKU (number of deployed units of the SKU). For
     * Consumption SKU capacity must be specified as 0.
     */
    @JsonProperty(value = "capacity", required = true)
    private int capacity;

    /**
     * Get the name property: Name of the Sku.
     *
     * @return the name value.
     */
    public SkuType name() {
        return this.name;
    }

    /**
     * Set the name property: Name of the Sku.
     *
     * @param name the name value to set.
     * @return the ApiManagementServiceSkuProperties object itself.
     */
    public ApiManagementServiceSkuProperties withName(SkuType name) {
        this.name = name;
        return this;
    }

    /**
     * Get the capacity property: Capacity of the SKU (number of deployed units of the SKU). For Consumption SKU
     * capacity must be specified as 0.
     *
     * @return the capacity value.
     */
    public int capacity() {
        return this.capacity;
    }

    /**
     * Set the capacity property: Capacity of the SKU (number of deployed units of the SKU). For Consumption SKU
     * capacity must be specified as 0.
     *
     * @param capacity the capacity value to set.
     * @return the ApiManagementServiceSkuProperties object itself.
     */
    public ApiManagementServiceSkuProperties withCapacity(int capacity) {
        this.capacity = capacity;
        return this;
    }

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

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