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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.resourcemanager.resourceconnector.models.AppliancePropertiesInfrastructureConfig;
import com.azure.resourcemanager.resourceconnector.models.Distro;
import com.azure.resourcemanager.resourceconnector.models.Identity;
import com.azure.resourcemanager.resourceconnector.models.Status;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** Appliances definition. */
@Fluent
public final class ApplianceInner extends Resource {
    /*
     * Identity for the resource.
     */
    @JsonProperty(value = "identity")
    private Identity identity;

    /*
     * The set of properties specific to an Appliance
     */
    @JsonProperty(value = "properties")
    private ApplianceProperties innerProperties;

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

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

    /**
     * Get the identity property: Identity for the resource.
     *
     * @return the identity value.
     */
    public Identity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: Identity for the resource.
     *
     * @param identity the identity value to set.
     * @return the ApplianceInner object itself.
     */
    public ApplianceInner withIdentity(Identity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the innerProperties property: The set of properties specific to an Appliance.
     *
     * @return the innerProperties value.
     */
    private ApplianceProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

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

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

    /**
     * Get the distro property: Represents a supported Fabric/Infra. (AKSEdge etc...).
     *
     * @return the distro value.
     */
    public Distro distro() {
        return this.innerProperties() == null ? null : this.innerProperties().distro();
    }

    /**
     * Set the distro property: Represents a supported Fabric/Infra. (AKSEdge etc...).
     *
     * @param distro the distro value to set.
     * @return the ApplianceInner object itself.
     */
    public ApplianceInner withDistro(Distro distro) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ApplianceProperties();
        }
        this.innerProperties().withDistro(distro);
        return this;
    }

    /**
     * Get the infrastructureConfig property: Contains infrastructure information about the Appliance.
     *
     * @return the infrastructureConfig value.
     */
    public AppliancePropertiesInfrastructureConfig infrastructureConfig() {
        return this.innerProperties() == null ? null : this.innerProperties().infrastructureConfig();
    }

    /**
     * Set the infrastructureConfig property: Contains infrastructure information about the Appliance.
     *
     * @param infrastructureConfig the infrastructureConfig value to set.
     * @return the ApplianceInner object itself.
     */
    public ApplianceInner withInfrastructureConfig(AppliancePropertiesInfrastructureConfig infrastructureConfig) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ApplianceProperties();
        }
        this.innerProperties().withInfrastructureConfig(infrastructureConfig);
        return this;
    }

    /**
     * Get the provisioningState property: The current deployment or provisioning state, which only appears in the
     * response.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the publicKey property: Certificates pair used to download MSI certificate from HIS. Can only be set once.
     *
     * @return the publicKey value.
     */
    public String publicKey() {
        return this.innerProperties() == null ? null : this.innerProperties().publicKey();
    }

    /**
     * Set the publicKey property: Certificates pair used to download MSI certificate from HIS. Can only be set once.
     *
     * @param publicKey the publicKey value to set.
     * @return the ApplianceInner object itself.
     */
    public ApplianceInner withPublicKey(String publicKey) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ApplianceProperties();
        }
        this.innerProperties().withPublicKey(publicKey);
        return this;
    }

    /**
     * Get the status property: Appliance’s health and state of connection to on-prem.
     *
     * @return the status value.
     */
    public Status status() {
        return this.innerProperties() == null ? null : this.innerProperties().status();
    }

    /**
     * Get the version property: Version of the Appliance.
     *
     * @return the version value.
     */
    public String version() {
        return this.innerProperties() == null ? null : this.innerProperties().version();
    }

    /**
     * Set the version property: Version of the Appliance.
     *
     * @param version the version value to set.
     * @return the ApplianceInner object itself.
     */
    public ApplianceInner withVersion(String version) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ApplianceProperties();
        }
        this.innerProperties().withVersion(version);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (identity() != null) {
            identity().validate();
        }
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }
}
