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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.core.management.exception.ManagementError;
import com.azure.resourcemanager.kubernetesconfiguration.models.ExtensionPropertiesAksAssignedIdentity;
import com.azure.resourcemanager.kubernetesconfiguration.models.ExtensionStatus;
import com.azure.resourcemanager.kubernetesconfiguration.models.Identity;
import com.azure.resourcemanager.kubernetesconfiguration.models.Plan;
import com.azure.resourcemanager.kubernetesconfiguration.models.ProvisioningState;
import com.azure.resourcemanager.kubernetesconfiguration.models.Scope;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** The Extension object. */
@Fluent
public final class ExtensionInner extends ProxyResource {
    /*
     * Properties of an Extension resource
     */
    @JsonProperty(value = "properties")
    private ExtensionProperties innerProperties;

    /*
     * Identity of the Extension resource
     */
    @JsonProperty(value = "identity")
    private Identity identity;

    /*
     * Top level metadata
     * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

    /*
     * The plan information.
     */
    @JsonProperty(value = "plan")
    private Plan plan;

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

    /**
     * Get the innerProperties property: Properties of an Extension resource.
     *
     * @return the innerProperties value.
     */
    private ExtensionProperties innerProperties() {
        return this.innerProperties;
    }

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

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

    /**
     * Get the systemData property: Top level metadata
     * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the plan property: The plan information.
     *
     * @return the plan value.
     */
    public Plan plan() {
        return this.plan;
    }

    /**
     * Set the plan property: The plan information.
     *
     * @param plan the plan value to set.
     * @return the ExtensionInner object itself.
     */
    public ExtensionInner withPlan(Plan plan) {
        this.plan = plan;
        return this;
    }

    /**
     * Get the extensionType property: Type of the Extension, of which this resource is an instance of. It must be one
     * of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher.
     *
     * @return the extensionType value.
     */
    public String extensionType() {
        return this.innerProperties() == null ? null : this.innerProperties().extensionType();
    }

    /**
     * Set the extensionType property: Type of the Extension, of which this resource is an instance of. It must be one
     * of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher.
     *
     * @param extensionType the extensionType value to set.
     * @return the ExtensionInner object itself.
     */
    public ExtensionInner withExtensionType(String extensionType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ExtensionProperties();
        }
        this.innerProperties().withExtensionType(extensionType);
        return this;
    }

    /**
     * Get the autoUpgradeMinorVersion property: Flag to note if this extension participates in auto upgrade of minor
     * version, or not.
     *
     * @return the autoUpgradeMinorVersion value.
     */
    public Boolean autoUpgradeMinorVersion() {
        return this.innerProperties() == null ? null : this.innerProperties().autoUpgradeMinorVersion();
    }

    /**
     * Set the autoUpgradeMinorVersion property: Flag to note if this extension participates in auto upgrade of minor
     * version, or not.
     *
     * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set.
     * @return the ExtensionInner object itself.
     */
    public ExtensionInner withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ExtensionProperties();
        }
        this.innerProperties().withAutoUpgradeMinorVersion(autoUpgradeMinorVersion);
        return this;
    }

    /**
     * Get the releaseTrain property: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable,
     * Preview, etc.) - only if autoUpgradeMinorVersion is 'true'.
     *
     * @return the releaseTrain value.
     */
    public String releaseTrain() {
        return this.innerProperties() == null ? null : this.innerProperties().releaseTrain();
    }

    /**
     * Set the releaseTrain property: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable,
     * Preview, etc.) - only if autoUpgradeMinorVersion is 'true'.
     *
     * @param releaseTrain the releaseTrain value to set.
     * @return the ExtensionInner object itself.
     */
    public ExtensionInner withReleaseTrain(String releaseTrain) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ExtensionProperties();
        }
        this.innerProperties().withReleaseTrain(releaseTrain);
        return this;
    }

    /**
     * Get the version property: User-specified version of the extension for this extension to 'pin'. To use 'version',
     * autoUpgradeMinorVersion must be 'false'.
     *
     * @return the version value.
     */
    public String version() {
        return this.innerProperties() == null ? null : this.innerProperties().version();
    }

    /**
     * Set the version property: User-specified version of the extension for this extension to 'pin'. To use 'version',
     * autoUpgradeMinorVersion must be 'false'.
     *
     * @param version the version value to set.
     * @return the ExtensionInner object itself.
     */
    public ExtensionInner withVersion(String version) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ExtensionProperties();
        }
        this.innerProperties().withVersion(version);
        return this;
    }

    /**
     * Get the scope property: Scope at which the extension is installed.
     *
     * @return the scope value.
     */
    public Scope scope() {
        return this.innerProperties() == null ? null : this.innerProperties().scope();
    }

    /**
     * Set the scope property: Scope at which the extension is installed.
     *
     * @param scope the scope value to set.
     * @return the ExtensionInner object itself.
     */
    public ExtensionInner withScope(Scope scope) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ExtensionProperties();
        }
        this.innerProperties().withScope(scope);
        return this;
    }

    /**
     * Get the configurationSettings property: Configuration settings, as name-value pairs for configuring this
     * extension.
     *
     * @return the configurationSettings value.
     */
    public Map<String, String> configurationSettings() {
        return this.innerProperties() == null ? null : this.innerProperties().configurationSettings();
    }

    /**
     * Set the configurationSettings property: Configuration settings, as name-value pairs for configuring this
     * extension.
     *
     * @param configurationSettings the configurationSettings value to set.
     * @return the ExtensionInner object itself.
     */
    public ExtensionInner withConfigurationSettings(Map<String, String> configurationSettings) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ExtensionProperties();
        }
        this.innerProperties().withConfigurationSettings(configurationSettings);
        return this;
    }

    /**
     * Get the configurationProtectedSettings property: Configuration settings that are sensitive, as name-value pairs
     * for configuring this extension.
     *
     * @return the configurationProtectedSettings value.
     */
    public Map<String, String> configurationProtectedSettings() {
        return this.innerProperties() == null ? null : this.innerProperties().configurationProtectedSettings();
    }

    /**
     * Set the configurationProtectedSettings property: Configuration settings that are sensitive, as name-value pairs
     * for configuring this extension.
     *
     * @param configurationProtectedSettings the configurationProtectedSettings value to set.
     * @return the ExtensionInner object itself.
     */
    public ExtensionInner withConfigurationProtectedSettings(Map<String, String> configurationProtectedSettings) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ExtensionProperties();
        }
        this.innerProperties().withConfigurationProtectedSettings(configurationProtectedSettings);
        return this;
    }

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

    /**
     * Get the provisioningState property: Status of installation of this extension.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the statuses property: Status from this extension.
     *
     * @return the statuses value.
     */
    public List<ExtensionStatus> statuses() {
        return this.innerProperties() == null ? null : this.innerProperties().statuses();
    }

    /**
     * Set the statuses property: Status from this extension.
     *
     * @param statuses the statuses value to set.
     * @return the ExtensionInner object itself.
     */
    public ExtensionInner withStatuses(List<ExtensionStatus> statuses) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ExtensionProperties();
        }
        this.innerProperties().withStatuses(statuses);
        return this;
    }

    /**
     * Get the errorInfo property: Error information from the Agent - e.g. errors during installation.
     *
     * @return the errorInfo value.
     */
    public ManagementError errorInfo() {
        return this.innerProperties() == null ? null : this.innerProperties().errorInfo();
    }

    /**
     * Get the customLocationSettings property: Custom Location settings properties.
     *
     * @return the customLocationSettings value.
     */
    public Map<String, String> customLocationSettings() {
        return this.innerProperties() == null ? null : this.innerProperties().customLocationSettings();
    }

    /**
     * Get the packageUri property: Uri of the Helm package.
     *
     * @return the packageUri value.
     */
    public String packageUri() {
        return this.innerProperties() == null ? null : this.innerProperties().packageUri();
    }

    /**
     * Get the aksAssignedIdentity property: Identity of the Extension resource in an AKS cluster.
     *
     * @return the aksAssignedIdentity value.
     */
    public ExtensionPropertiesAksAssignedIdentity aksAssignedIdentity() {
        return this.innerProperties() == null ? null : this.innerProperties().aksAssignedIdentity();
    }

    /**
     * Set the aksAssignedIdentity property: Identity of the Extension resource in an AKS cluster.
     *
     * @param aksAssignedIdentity the aksAssignedIdentity value to set.
     * @return the ExtensionInner object itself.
     */
    public ExtensionInner withAksAssignedIdentity(ExtensionPropertiesAksAssignedIdentity aksAssignedIdentity) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ExtensionProperties();
        }
        this.innerProperties().withAksAssignedIdentity(aksAssignedIdentity);
        return this;
    }

    /**
     * Get the isSystemExtension property: Flag to note if this extension is a system extension.
     *
     * @return the isSystemExtension value.
     */
    public Boolean isSystemExtension() {
        return this.innerProperties() == null ? null : this.innerProperties().isSystemExtension();
    }

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