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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.devspaces.models.ProvisioningState;
import com.azure.resourcemanager.devspaces.models.Sku;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** The Controller model. */
@Fluent
public final class ControllerInner extends Resource {
    /*
     * The properties property.
     */
    @JsonProperty(value = "properties", required = true)
    private ControllerProperties innerProperties = new ControllerProperties();

    /*
     * Model representing SKU for Azure Dev Spaces Controller.
     */
    @JsonProperty(value = "sku", required = true)
    private Sku sku;

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

    /**
     * Get the innerProperties property: The properties property.
     *
     * @return the innerProperties value.
     */
    private ControllerProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the sku property: Model representing SKU for Azure Dev Spaces Controller.
     *
     * @return the sku value.
     */
    public Sku sku() {
        return this.sku;
    }

    /**
     * Set the sku property: Model representing SKU for Azure Dev Spaces Controller.
     *
     * @param sku the sku value to set.
     * @return the ControllerInner object itself.
     */
    public ControllerInner withSku(Sku sku) {
        this.sku = sku;
        return this;
    }

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

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

    /**
     * Get the provisioningState property: Provisioning state of the Azure Dev Spaces Controller.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the hostSuffix property: DNS suffix for public endpoints running in the Azure Dev Spaces Controller.
     *
     * @return the hostSuffix value.
     */
    public String hostSuffix() {
        return this.innerProperties() == null ? null : this.innerProperties().hostSuffix();
    }

    /**
     * Get the dataPlaneFqdn property: DNS name for accessing DataPlane services.
     *
     * @return the dataPlaneFqdn value.
     */
    public String dataPlaneFqdn() {
        return this.innerProperties() == null ? null : this.innerProperties().dataPlaneFqdn();
    }

    /**
     * Get the targetContainerHostApiServerFqdn property: DNS of the target container host's API server.
     *
     * @return the targetContainerHostApiServerFqdn value.
     */
    public String targetContainerHostApiServerFqdn() {
        return this.innerProperties() == null ? null : this.innerProperties().targetContainerHostApiServerFqdn();
    }

    /**
     * Get the targetContainerHostResourceId property: Resource ID of the target container host.
     *
     * @return the targetContainerHostResourceId value.
     */
    public String targetContainerHostResourceId() {
        return this.innerProperties() == null ? null : this.innerProperties().targetContainerHostResourceId();
    }

    /**
     * Set the targetContainerHostResourceId property: Resource ID of the target container host.
     *
     * @param targetContainerHostResourceId the targetContainerHostResourceId value to set.
     * @return the ControllerInner object itself.
     */
    public ControllerInner withTargetContainerHostResourceId(String targetContainerHostResourceId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ControllerProperties();
        }
        this.innerProperties().withTargetContainerHostResourceId(targetContainerHostResourceId);
        return this;
    }

    /**
     * Get the targetContainerHostCredentialsBase64 property: Credentials of the target container host (base64).
     *
     * @return the targetContainerHostCredentialsBase64 value.
     */
    public String targetContainerHostCredentialsBase64() {
        return this.innerProperties() == null ? null : this.innerProperties().targetContainerHostCredentialsBase64();
    }

    /**
     * Set the targetContainerHostCredentialsBase64 property: Credentials of the target container host (base64).
     *
     * @param targetContainerHostCredentialsBase64 the targetContainerHostCredentialsBase64 value to set.
     * @return the ControllerInner object itself.
     */
    public ControllerInner withTargetContainerHostCredentialsBase64(String targetContainerHostCredentialsBase64) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ControllerProperties();
        }
        this.innerProperties().withTargetContainerHostCredentialsBase64(targetContainerHostCredentialsBase64);
        return this;
    }

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

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