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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.resourcemanager.workloads.models.ProviderInstancePropertiesErrors;
import com.azure.resourcemanager.workloads.models.ProviderSpecificProperties;
import com.azure.resourcemanager.workloads.models.UserAssignedServiceIdentity;
import com.azure.resourcemanager.workloads.models.WorkloadMonitorProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;

/** A provider instance associated with SAP monitor. */
@Fluent
public final class ProviderInstanceInner extends ProxyResource {
    /*
     * [currently not in use] Managed service identity(user assigned identities)
     */
    @JsonProperty(value = "identity")
    private UserAssignedServiceIdentity identity;

    /*
     * Provider Instance properties
     */
    @JsonProperty(value = "properties")
    private ProviderInstanceProperties 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 ProviderInstanceInner class. */
    public ProviderInstanceInner() {
    }

    /**
     * Get the identity property: [currently not in use] Managed service identity(user assigned identities).
     *
     * @return the identity value.
     */
    public UserAssignedServiceIdentity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: [currently not in use] Managed service identity(user assigned identities).
     *
     * @param identity the identity value to set.
     * @return the ProviderInstanceInner object itself.
     */
    public ProviderInstanceInner withIdentity(UserAssignedServiceIdentity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the innerProperties property: Provider Instance properties.
     *
     * @return the innerProperties value.
     */
    private ProviderInstanceProperties 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;
    }

    /**
     * Get the provisioningState property: State of provisioning of the provider instance.
     *
     * @return the provisioningState value.
     */
    public WorkloadMonitorProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the errors property: Defines the provider instance errors.
     *
     * @return the errors value.
     */
    public ProviderInstancePropertiesErrors errors() {
        return this.innerProperties() == null ? null : this.innerProperties().errors();
    }

    /**
     * Get the providerSettings property: Defines the provider specific properties.
     *
     * @return the providerSettings value.
     */
    public ProviderSpecificProperties providerSettings() {
        return this.innerProperties() == null ? null : this.innerProperties().providerSettings();
    }

    /**
     * Set the providerSettings property: Defines the provider specific properties.
     *
     * @param providerSettings the providerSettings value to set.
     * @return the ProviderInstanceInner object itself.
     */
    public ProviderInstanceInner withProviderSettings(ProviderSpecificProperties providerSettings) {
        if (this.innerProperties() == null) {
            this.innerProperties = new ProviderInstanceProperties();
        }
        this.innerProperties().withProviderSettings(providerSettings);
        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();
        }
    }
}
