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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.powerbidedicated.models.AutoScaleVCoreSku;
import com.azure.resourcemanager.powerbidedicated.models.VCoreProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** Represents an instance of an auto scale v-core resource. */
@Fluent
public final class AutoScaleVCoreInner extends Resource {
    /*
     * The SKU of the auto scale v-core resource.
     */
    @JsonProperty(value = "sku", required = true)
    private AutoScaleVCoreSku sku;

    /*
     * Properties of an auto scale v-core resource.
     */
    @JsonProperty(value = "properties")
    private AutoScaleVCoreProperties innerProperties;

    /*
     * Metadata pertaining to creation and last modification of the resource.
     */
    @JsonProperty(value = "systemData")
    private SystemData systemData;

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

    /**
     * Get the sku property: The SKU of the auto scale v-core resource.
     *
     * @return the sku value.
     */
    public AutoScaleVCoreSku sku() {
        return this.sku;
    }

    /**
     * Set the sku property: The SKU of the auto scale v-core resource.
     *
     * @param sku the sku value to set.
     * @return the AutoScaleVCoreInner object itself.
     */
    public AutoScaleVCoreInner withSku(AutoScaleVCoreSku sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the innerProperties property: Properties of an auto scale v-core resource.
     *
     * @return the innerProperties value.
     */
    private AutoScaleVCoreProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Metadata pertaining to creation and last modification of the resource.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Set the systemData property: Metadata pertaining to creation and last modification of the resource.
     *
     * @param systemData the systemData value to set.
     * @return the AutoScaleVCoreInner object itself.
     */
    public AutoScaleVCoreInner withSystemData(SystemData systemData) {
        this.systemData = systemData;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public AutoScaleVCoreInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public AutoScaleVCoreInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the capacityObjectId property: The object ID of the capacity resource associated with the auto scale v-core
     * resource.
     *
     * @return the capacityObjectId value.
     */
    public String capacityObjectId() {
        return this.innerProperties() == null ? null : this.innerProperties().capacityObjectId();
    }

    /**
     * Set the capacityObjectId property: The object ID of the capacity resource associated with the auto scale v-core
     * resource.
     *
     * @param capacityObjectId the capacityObjectId value to set.
     * @return the AutoScaleVCoreInner object itself.
     */
    public AutoScaleVCoreInner withCapacityObjectId(String capacityObjectId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AutoScaleVCoreProperties();
        }
        this.innerProperties().withCapacityObjectId(capacityObjectId);
        return this;
    }

    /**
     * Get the provisioningState property: The current deployment state of an auto scale v-core resource. The
     * provisioningState is to indicate states for resource provisioning.
     *
     * @return the provisioningState value.
     */
    public VCoreProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the capacityLimit property: The maximum capacity of an auto scale v-core resource.
     *
     * @return the capacityLimit value.
     */
    public Integer capacityLimit() {
        return this.innerProperties() == null ? null : this.innerProperties().capacityLimit();
    }

    /**
     * Set the capacityLimit property: The maximum capacity of an auto scale v-core resource.
     *
     * @param capacityLimit the capacityLimit value to set.
     * @return the AutoScaleVCoreInner object itself.
     */
    public AutoScaleVCoreInner withCapacityLimit(Integer capacityLimit) {
        if (this.innerProperties() == null) {
            this.innerProperties = new AutoScaleVCoreProperties();
        }
        this.innerProperties().withCapacityLimit(capacityLimit);
        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 AutoScaleVCoreInner"));
        } else {
            sku().validate();
        }
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }

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