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

package com.azure.resourcemanager.hybridcontainerservice.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** HybridAKSClusterStatus defines the observed state of HybridAKSCluster. */
@Fluent
public final class ProvisionedClustersCommonPropertiesStatus {
    /*
     * Additional features status like Arc Agent Onboarding.
     */
    @JsonProperty(value = "featuresStatus")
    private ProvisionedClustersCommonPropertiesStatusFeaturesStatus featuresStatus;

    /*
     * AddonStatus - Status of Addons
     */
    @JsonProperty(value = "addonStatus")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, AddonStatus> addonStatus;

    /*
     * ErrorMessage - Error messages during creation of cluster
     */
    @JsonProperty(value = "errorMessage")
    private String errorMessage;

    /*
     * Contains Provisioning errors
     */
    @JsonProperty(value = "provisioningStatus")
    private ProvisionedClustersCommonPropertiesStatusProvisioningStatus provisioningStatus;

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

    /**
     * Get the featuresStatus property: Additional features status like Arc Agent Onboarding.
     *
     * @return the featuresStatus value.
     */
    public ProvisionedClustersCommonPropertiesStatusFeaturesStatus featuresStatus() {
        return this.featuresStatus;
    }

    /**
     * Set the featuresStatus property: Additional features status like Arc Agent Onboarding.
     *
     * @param featuresStatus the featuresStatus value to set.
     * @return the ProvisionedClustersCommonPropertiesStatus object itself.
     */
    public ProvisionedClustersCommonPropertiesStatus withFeaturesStatus(
        ProvisionedClustersCommonPropertiesStatusFeaturesStatus featuresStatus) {
        this.featuresStatus = featuresStatus;
        return this;
    }

    /**
     * Get the addonStatus property: AddonStatus - Status of Addons.
     *
     * @return the addonStatus value.
     */
    public Map<String, AddonStatus> addonStatus() {
        return this.addonStatus;
    }

    /**
     * Set the addonStatus property: AddonStatus - Status of Addons.
     *
     * @param addonStatus the addonStatus value to set.
     * @return the ProvisionedClustersCommonPropertiesStatus object itself.
     */
    public ProvisionedClustersCommonPropertiesStatus withAddonStatus(Map<String, AddonStatus> addonStatus) {
        this.addonStatus = addonStatus;
        return this;
    }

    /**
     * Get the errorMessage property: ErrorMessage - Error messages during creation of cluster.
     *
     * @return the errorMessage value.
     */
    public String errorMessage() {
        return this.errorMessage;
    }

    /**
     * Set the errorMessage property: ErrorMessage - Error messages during creation of cluster.
     *
     * @param errorMessage the errorMessage value to set.
     * @return the ProvisionedClustersCommonPropertiesStatus object itself.
     */
    public ProvisionedClustersCommonPropertiesStatus withErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
        return this;
    }

    /**
     * Get the provisioningStatus property: Contains Provisioning errors.
     *
     * @return the provisioningStatus value.
     */
    public ProvisionedClustersCommonPropertiesStatusProvisioningStatus provisioningStatus() {
        return this.provisioningStatus;
    }

    /**
     * Set the provisioningStatus property: Contains Provisioning errors.
     *
     * @param provisioningStatus the provisioningStatus value to set.
     * @return the ProvisionedClustersCommonPropertiesStatus object itself.
     */
    public ProvisionedClustersCommonPropertiesStatus withProvisioningStatus(
        ProvisionedClustersCommonPropertiesStatusProvisioningStatus provisioningStatus) {
        this.provisioningStatus = provisioningStatus;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (featuresStatus() != null) {
            featuresStatus().validate();
        }
        if (addonStatus() != null) {
            addonStatus()
                .values()
                .forEach(
                    e -> {
                        if (e != null) {
                            e.validate();
                        }
                    });
        }
        if (provisioningStatus() != null) {
            provisioningStatus().validate();
        }
    }
}
