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

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

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.policyinsights.models.RemediationDeploymentSummary;
import com.azure.resourcemanager.policyinsights.models.RemediationFilters;
import com.azure.resourcemanager.policyinsights.models.RemediationPropertiesFailureThreshold;
import com.azure.resourcemanager.policyinsights.models.ResourceDiscoveryMode;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** The remediation properties. */
@Fluent
public final class RemediationProperties {
    /*
     * The resource ID of the policy assignment that should be remediated.
     */
    @JsonProperty(value = "policyAssignmentId")
    private String policyAssignmentId;

    /*
     * The policy definition reference ID of the individual definition that should be remediated. Required when the
     * policy assignment being remediated assigns a policy set definition.
     */
    @JsonProperty(value = "policyDefinitionReferenceId")
    private String policyDefinitionReferenceId;

    /*
     * The way resources to remediate are discovered. Defaults to ExistingNonCompliant if not specified.
     */
    @JsonProperty(value = "resourceDiscoveryMode")
    private ResourceDiscoveryMode resourceDiscoveryMode;

    /*
     * The status of the remediation.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private String provisioningState;

    /*
     * The time at which the remediation was created.
     */
    @JsonProperty(value = "createdOn", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime createdOn;

    /*
     * The time at which the remediation was last updated.
     */
    @JsonProperty(value = "lastUpdatedOn", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime lastUpdatedOn;

    /*
     * The filters that will be applied to determine which resources to remediate.
     */
    @JsonProperty(value = "filters")
    private RemediationFilters filters;

    /*
     * The deployment status summary for all deployments created by the remediation.
     */
    @JsonProperty(value = "deploymentStatus", access = JsonProperty.Access.WRITE_ONLY)
    private RemediationDeploymentSummary deploymentStatus;

    /*
     * The remediation status message. Provides additional details regarding the state of the remediation.
     */
    @JsonProperty(value = "statusMessage", access = JsonProperty.Access.WRITE_ONLY)
    private String statusMessage;

    /*
     * The remediation correlation Id. Can be used to find events related to the remediation in the activity log.
     */
    @JsonProperty(value = "correlationId", access = JsonProperty.Access.WRITE_ONLY)
    private String correlationId;

    /*
     * Determines the max number of resources that can be remediated by the remediation job. If not provided, the
     * default resource count is used.
     */
    @JsonProperty(value = "resourceCount")
    private Integer resourceCount;

    /*
     * Determines how many resources to remediate at any given time. Can be used to increase or reduce the pace of the
     * remediation. If not provided, the default parallel deployments value is used.
     */
    @JsonProperty(value = "parallelDeployments")
    private Integer parallelDeployments;

    /*
     * The remediation failure threshold settings
     */
    @JsonProperty(value = "failureThreshold")
    private RemediationPropertiesFailureThreshold failureThreshold;

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

    /**
     * Get the policyAssignmentId property: The resource ID of the policy assignment that should be remediated.
     *
     * @return the policyAssignmentId value.
     */
    public String policyAssignmentId() {
        return this.policyAssignmentId;
    }

    /**
     * Set the policyAssignmentId property: The resource ID of the policy assignment that should be remediated.
     *
     * @param policyAssignmentId the policyAssignmentId value to set.
     * @return the RemediationProperties object itself.
     */
    public RemediationProperties withPolicyAssignmentId(String policyAssignmentId) {
        this.policyAssignmentId = policyAssignmentId;
        return this;
    }

    /**
     * Get the policyDefinitionReferenceId property: The policy definition reference ID of the individual definition
     * that should be remediated. Required when the policy assignment being remediated assigns a policy set definition.
     *
     * @return the policyDefinitionReferenceId value.
     */
    public String policyDefinitionReferenceId() {
        return this.policyDefinitionReferenceId;
    }

    /**
     * Set the policyDefinitionReferenceId property: The policy definition reference ID of the individual definition
     * that should be remediated. Required when the policy assignment being remediated assigns a policy set definition.
     *
     * @param policyDefinitionReferenceId the policyDefinitionReferenceId value to set.
     * @return the RemediationProperties object itself.
     */
    public RemediationProperties withPolicyDefinitionReferenceId(String policyDefinitionReferenceId) {
        this.policyDefinitionReferenceId = policyDefinitionReferenceId;
        return this;
    }

    /**
     * Get the resourceDiscoveryMode property: The way resources to remediate are discovered. Defaults to
     * ExistingNonCompliant if not specified.
     *
     * @return the resourceDiscoveryMode value.
     */
    public ResourceDiscoveryMode resourceDiscoveryMode() {
        return this.resourceDiscoveryMode;
    }

    /**
     * Set the resourceDiscoveryMode property: The way resources to remediate are discovered. Defaults to
     * ExistingNonCompliant if not specified.
     *
     * @param resourceDiscoveryMode the resourceDiscoveryMode value to set.
     * @return the RemediationProperties object itself.
     */
    public RemediationProperties withResourceDiscoveryMode(ResourceDiscoveryMode resourceDiscoveryMode) {
        this.resourceDiscoveryMode = resourceDiscoveryMode;
        return this;
    }

    /**
     * Get the provisioningState property: The status of the remediation.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the createdOn property: The time at which the remediation was created.
     *
     * @return the createdOn value.
     */
    public OffsetDateTime createdOn() {
        return this.createdOn;
    }

    /**
     * Get the lastUpdatedOn property: The time at which the remediation was last updated.
     *
     * @return the lastUpdatedOn value.
     */
    public OffsetDateTime lastUpdatedOn() {
        return this.lastUpdatedOn;
    }

    /**
     * Get the filters property: The filters that will be applied to determine which resources to remediate.
     *
     * @return the filters value.
     */
    public RemediationFilters filters() {
        return this.filters;
    }

    /**
     * Set the filters property: The filters that will be applied to determine which resources to remediate.
     *
     * @param filters the filters value to set.
     * @return the RemediationProperties object itself.
     */
    public RemediationProperties withFilters(RemediationFilters filters) {
        this.filters = filters;
        return this;
    }

    /**
     * Get the deploymentStatus property: The deployment status summary for all deployments created by the remediation.
     *
     * @return the deploymentStatus value.
     */
    public RemediationDeploymentSummary deploymentStatus() {
        return this.deploymentStatus;
    }

    /**
     * Get the statusMessage property: The remediation status message. Provides additional details regarding the state
     * of the remediation.
     *
     * @return the statusMessage value.
     */
    public String statusMessage() {
        return this.statusMessage;
    }

    /**
     * Get the correlationId property: The remediation correlation Id. Can be used to find events related to the
     * remediation in the activity log.
     *
     * @return the correlationId value.
     */
    public String correlationId() {
        return this.correlationId;
    }

    /**
     * Get the resourceCount property: Determines the max number of resources that can be remediated by the remediation
     * job. If not provided, the default resource count is used.
     *
     * @return the resourceCount value.
     */
    public Integer resourceCount() {
        return this.resourceCount;
    }

    /**
     * Set the resourceCount property: Determines the max number of resources that can be remediated by the remediation
     * job. If not provided, the default resource count is used.
     *
     * @param resourceCount the resourceCount value to set.
     * @return the RemediationProperties object itself.
     */
    public RemediationProperties withResourceCount(Integer resourceCount) {
        this.resourceCount = resourceCount;
        return this;
    }

    /**
     * Get the parallelDeployments property: Determines how many resources to remediate at any given time. Can be used
     * to increase or reduce the pace of the remediation. If not provided, the default parallel deployments value is
     * used.
     *
     * @return the parallelDeployments value.
     */
    public Integer parallelDeployments() {
        return this.parallelDeployments;
    }

    /**
     * Set the parallelDeployments property: Determines how many resources to remediate at any given time. Can be used
     * to increase or reduce the pace of the remediation. If not provided, the default parallel deployments value is
     * used.
     *
     * @param parallelDeployments the parallelDeployments value to set.
     * @return the RemediationProperties object itself.
     */
    public RemediationProperties withParallelDeployments(Integer parallelDeployments) {
        this.parallelDeployments = parallelDeployments;
        return this;
    }

    /**
     * Get the failureThreshold property: The remediation failure threshold settings.
     *
     * @return the failureThreshold value.
     */
    public RemediationPropertiesFailureThreshold failureThreshold() {
        return this.failureThreshold;
    }

    /**
     * Set the failureThreshold property: The remediation failure threshold settings.
     *
     * @param failureThreshold the failureThreshold value to set.
     * @return the RemediationProperties object itself.
     */
    public RemediationProperties withFailureThreshold(RemediationPropertiesFailureThreshold failureThreshold) {
        this.failureThreshold = failureThreshold;
        return this;
    }

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