// 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.CapacityProvisioningState;
import com.azure.resourcemanager.powerbidedicated.models.CapacitySku;
import com.azure.resourcemanager.powerbidedicated.models.DedicatedCapacityAdministrators;
import com.azure.resourcemanager.powerbidedicated.models.Mode;
import com.azure.resourcemanager.powerbidedicated.models.State;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** Represents an instance of a Dedicated Capacity resource. */
@Fluent
public final class DedicatedCapacityInner extends Resource {
    /*
     * The SKU of the PowerBI Dedicated capacity resource.
     */
    @JsonProperty(value = "sku", required = true)
    private CapacitySku sku;

    /*
     * Properties of the provision operation request.
     */
    @JsonProperty(value = "properties")
    private DedicatedCapacityProperties innerProperties;

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

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

    /**
     * Get the sku property: The SKU of the PowerBI Dedicated capacity resource.
     *
     * @return the sku value.
     */
    public CapacitySku sku() {
        return this.sku;
    }

    /**
     * Set the sku property: The SKU of the PowerBI Dedicated capacity resource.
     *
     * @param sku the sku value to set.
     * @return the DedicatedCapacityInner object itself.
     */
    public DedicatedCapacityInner withSku(CapacitySku sku) {
        this.sku = sku;
        return this;
    }

    /**
     * Get the innerProperties property: Properties of the provision operation request.
     *
     * @return the innerProperties value.
     */
    private DedicatedCapacityProperties 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 DedicatedCapacityInner object itself.
     */
    public DedicatedCapacityInner withSystemData(SystemData systemData) {
        this.systemData = systemData;
        return this;
    }

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

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

    /**
     * Get the state property: The current state of PowerBI Dedicated resource. The state is to indicate more states
     * outside of resource provisioning.
     *
     * @return the state value.
     */
    public State state() {
        return this.innerProperties() == null ? null : this.innerProperties().state();
    }

    /**
     * Get the provisioningState property: The current deployment state of PowerBI Dedicated resource. The
     * provisioningState is to indicate states for resource provisioning.
     *
     * @return the provisioningState value.
     */
    public CapacityProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the administration property: A collection of Dedicated capacity administrators.
     *
     * @return the administration value.
     */
    public DedicatedCapacityAdministrators administration() {
        return this.innerProperties() == null ? null : this.innerProperties().administration();
    }

    /**
     * Set the administration property: A collection of Dedicated capacity administrators.
     *
     * @param administration the administration value to set.
     * @return the DedicatedCapacityInner object itself.
     */
    public DedicatedCapacityInner withAdministration(DedicatedCapacityAdministrators administration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DedicatedCapacityProperties();
        }
        this.innerProperties().withAdministration(administration);
        return this;
    }

    /**
     * Get the mode property: Specifies the generation of the Power BI Embedded capacity. If no value is specified, the
     * default value 'Gen2' is used. [Learn
     * More](https://docs.microsoft.com/power-bi/developer/embedded/power-bi-embedded-generation-2).
     *
     * @return the mode value.
     */
    public Mode mode() {
        return this.innerProperties() == null ? null : this.innerProperties().mode();
    }

    /**
     * Set the mode property: Specifies the generation of the Power BI Embedded capacity. If no value is specified, the
     * default value 'Gen2' is used. [Learn
     * More](https://docs.microsoft.com/power-bi/developer/embedded/power-bi-embedded-generation-2).
     *
     * @param mode the mode value to set.
     * @return the DedicatedCapacityInner object itself.
     */
    public DedicatedCapacityInner withMode(Mode mode) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DedicatedCapacityProperties();
        }
        this.innerProperties().withMode(mode);
        return this;
    }

    /**
     * Get the tenantId property: Tenant ID for the capacity. Used for creating Pro Plus capacity.
     *
     * @return the tenantId value.
     */
    public String tenantId() {
        return this.innerProperties() == null ? null : this.innerProperties().tenantId();
    }

    /**
     * Get the friendlyName property: Capacity name.
     *
     * @return the friendlyName value.
     */
    public String friendlyName() {
        return this.innerProperties() == null ? null : this.innerProperties().friendlyName();
    }

    /**
     * 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 DedicatedCapacityInner"));
        } else {
            sku().validate();
        }
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }

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