// 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;

/** Solution properties supported by the OperationsManagement resource provider. */
@Fluent
public final class SolutionProperties {
    /*
     * The azure resourceId for the workspace where the solution will be deployed/enabled.
     */
    @JsonProperty(value = "workspaceResourceId", required = true)
    private String workspaceResourceId;

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

    /*
     * The azure resources that will be contained within the solutions. They will be locked and gets deleted
     * automatically when the solution is deleted.
     */
    @JsonProperty(value = "containedResources")
    private List<String> containedResources;

    /*
     * The resources that will be referenced from this solution. Deleting any of those solution out of band will break
     * the solution.
     */
    @JsonProperty(value = "referencedResources")
    private List<String> referencedResources;

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

    /**
     * Get the workspaceResourceId property: The azure resourceId for the workspace where the solution will be
     * deployed/enabled.
     *
     * @return the workspaceResourceId value.
     */
    public String workspaceResourceId() {
        return this.workspaceResourceId;
    }

    /**
     * Set the workspaceResourceId property: The azure resourceId for the workspace where the solution will be
     * deployed/enabled.
     *
     * @param workspaceResourceId the workspaceResourceId value to set.
     * @return the SolutionProperties object itself.
     */
    public SolutionProperties withWorkspaceResourceId(String workspaceResourceId) {
        this.workspaceResourceId = workspaceResourceId;
        return this;
    }

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

    /**
     * Get the containedResources property: The azure resources that will be contained within the solutions. They will
     * be locked and gets deleted automatically when the solution is deleted.
     *
     * @return the containedResources value.
     */
    public List<String> containedResources() {
        return this.containedResources;
    }

    /**
     * Set the containedResources property: The azure resources that will be contained within the solutions. They will
     * be locked and gets deleted automatically when the solution is deleted.
     *
     * @param containedResources the containedResources value to set.
     * @return the SolutionProperties object itself.
     */
    public SolutionProperties withContainedResources(List<String> containedResources) {
        this.containedResources = containedResources;
        return this;
    }

    /**
     * Get the referencedResources property: The resources that will be referenced from this solution. Deleting any of
     * those solution out of band will break the solution.
     *
     * @return the referencedResources value.
     */
    public List<String> referencedResources() {
        return this.referencedResources;
    }

    /**
     * Set the referencedResources property: The resources that will be referenced from this solution. Deleting any of
     * those solution out of band will break the solution.
     *
     * @param referencedResources the referencedResources value to set.
     * @return the SolutionProperties object itself.
     */
    public SolutionProperties withReferencedResources(List<String> referencedResources) {
        this.referencedResources = referencedResources;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (workspaceResourceId() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property workspaceResourceId in model SolutionProperties"));
        }
    }

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