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

package com.azure.resourcemanager.operationsmanagement.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** ManagementConfiguration properties supported by the OperationsManagement resource provider. */
@Fluent
public final class ManagementConfigurationProperties {
    /*
     * The applicationId of the appliance for this Management.
     */
    @JsonProperty(value = "applicationId")
    private String applicationId;

    /*
     * The type of the parent resource.
     */
    @JsonProperty(value = "parentResourceType", required = true)
    private String parentResourceType;

    /*
     * Parameters to run the ARM template
     */
    @JsonProperty(value = "parameters", required = true)
    private List<ArmTemplateParameter> parameters;

    /*
     * The provisioning state for the ManagementConfiguration.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private String provisioningState;

    /*
     * The Json object containing the ARM template to deploy
     */
    @JsonProperty(value = "template", required = true)
    private Object template;

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

    /**
     * Get the applicationId property: The applicationId of the appliance for this Management.
     *
     * @return the applicationId value.
     */
    public String applicationId() {
        return this.applicationId;
    }

    /**
     * Set the applicationId property: The applicationId of the appliance for this Management.
     *
     * @param applicationId the applicationId value to set.
     * @return the ManagementConfigurationProperties object itself.
     */
    public ManagementConfigurationProperties withApplicationId(String applicationId) {
        this.applicationId = applicationId;
        return this;
    }

    /**
     * Get the parentResourceType property: The type of the parent resource.
     *
     * @return the parentResourceType value.
     */
    public String parentResourceType() {
        return this.parentResourceType;
    }

    /**
     * Set the parentResourceType property: The type of the parent resource.
     *
     * @param parentResourceType the parentResourceType value to set.
     * @return the ManagementConfigurationProperties object itself.
     */
    public ManagementConfigurationProperties withParentResourceType(String parentResourceType) {
        this.parentResourceType = parentResourceType;
        return this;
    }

    /**
     * Get the parameters property: Parameters to run the ARM template.
     *
     * @return the parameters value.
     */
    public List<ArmTemplateParameter> parameters() {
        return this.parameters;
    }

    /**
     * Set the parameters property: Parameters to run the ARM template.
     *
     * @param parameters the parameters value to set.
     * @return the ManagementConfigurationProperties object itself.
     */
    public ManagementConfigurationProperties withParameters(List<ArmTemplateParameter> parameters) {
        this.parameters = parameters;
        return this;
    }

    /**
     * Get the provisioningState property: The provisioning state for the ManagementConfiguration.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the template property: The Json object containing the ARM template to deploy.
     *
     * @return the template value.
     */
    public Object template() {
        return this.template;
    }

    /**
     * Set the template property: The Json object containing the ARM template to deploy.
     *
     * @param template the template value to set.
     * @return the ManagementConfigurationProperties object itself.
     */
    public ManagementConfigurationProperties withTemplate(Object template) {
        this.template = template;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (parentResourceType() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property parentResourceType in model ManagementConfigurationProperties"));
        }
        if (parameters() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property parameters in model ManagementConfigurationProperties"));
        } else {
            parameters().forEach(e -> e.validate());
        }
        if (template() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property template in model ManagementConfigurationProperties"));
        }
    }

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