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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.iothub.models.IotHubCapacity;
import com.azure.resourcemanager.iothub.models.IotHubSkuInfo;
import com.fasterxml.jackson.annotation.JsonProperty;

/** SKU properties. */
@Fluent
public final class IotHubSkuDescriptionInner {
    /*
     * The type of the resource.
     */
    @JsonProperty(value = "resourceType", access = JsonProperty.Access.WRITE_ONLY)
    private String resourceType;

    /*
     * The type of the resource.
     */
    @JsonProperty(value = "sku", required = true)
    private IotHubSkuInfo sku;

    /*
     * IotHub capacity
     */
    @JsonProperty(value = "capacity", required = true)
    private IotHubCapacity capacity;

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

    /**
     * Get the resourceType property: The type of the resource.
     *
     * @return the resourceType value.
     */
    public String resourceType() {
        return this.resourceType;
    }

    /**
     * Get the sku property: The type of the resource.
     *
     * @return the sku value.
     */
    public IotHubSkuInfo sku() {
        return this.sku;
    }

    /**
     * Set the sku property: The type of the resource.
     *
     * @param sku the sku value to set.
     * @return the IotHubSkuDescriptionInner object itself.
     */
    public IotHubSkuDescriptionInner withSku(IotHubSkuInfo sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the capacity property: IotHub capacity.
     *
     * @return the capacity value.
     */
    public IotHubCapacity capacity() {
        return this.capacity;
    }

    /**
     * Set the capacity property: IotHub capacity.
     *
     * @param capacity the capacity value to set.
     * @return the IotHubSkuDescriptionInner object itself.
     */
    public IotHubSkuDescriptionInner withCapacity(IotHubCapacity capacity) {
        this.capacity = capacity;
        return this;
    }

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

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