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

import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.Response;
import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner;
import java.time.OffsetDateTime;

/** An immutable client-side representation of Remediation. */
public interface Remediation {
    /**
     * Gets the id property: Fully qualified resource Id for the resource.
     *
     * @return the id value.
     */
    String id();

    /**
     * Gets the name property: The name of the resource.
     *
     * @return the name value.
     */
    String name();

    /**
     * Gets the type property: The type of the resource.
     *
     * @return the type value.
     */
    String type();

    /**
     * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     *
     * @return the systemData value.
     */
    SystemData systemData();

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

    /**
     * Gets 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.
     */
    String policyDefinitionReferenceId();

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

    /**
     * Gets the provisioningState property: The status of the remediation.
     *
     * @return the provisioningState value.
     */
    String provisioningState();

    /**
     * Gets the createdOn property: The time at which the remediation was created.
     *
     * @return the createdOn value.
     */
    OffsetDateTime createdOn();

    /**
     * Gets the lastUpdatedOn property: The time at which the remediation was last updated.
     *
     * @return the lastUpdatedOn value.
     */
    OffsetDateTime lastUpdatedOn();

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

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

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

    /**
     * Gets 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.
     */
    String correlationId();

    /**
     * Gets 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.
     */
    Integer resourceCount();

    /**
     * Gets 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.
     */
    Integer parallelDeployments();

    /**
     * Gets the failureThreshold property: The remediation failure threshold settings.
     *
     * @return the failureThreshold value.
     */
    RemediationPropertiesFailureThreshold failureThreshold();

    /**
     * Gets the name of the resource group.
     *
     * @return the name of the resource group.
     */
    String resourceGroupName();

    /**
     * Gets the inner com.azure.resourcemanager.policyinsights.fluent.models.RemediationInner object.
     *
     * @return the inner object.
     */
    RemediationInner innerModel();

    /** The entirety of the Remediation definition. */
    interface Definition
        extends DefinitionStages.Blank, DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate {
    }
    /** The Remediation definition stages. */
    interface DefinitionStages {
        /** The first stage of the Remediation definition. */
        interface Blank extends WithResourceGroup {
        }
        /** The stage of the Remediation definition allowing to specify parent resource. */
        interface WithResourceGroup {
            /**
             * Specifies resourceGroupName.
             *
             * @param resourceGroupName Resource group name.
             * @return the next definition stage.
             */
            WithCreate withExistingResourceGroup(String resourceGroupName);
        }
        /**
         * The stage of the Remediation definition which contains all the minimum required properties for the resource
         * to be created, but also allows for any other optional properties to be specified.
         */
        interface WithCreate
            extends DefinitionStages.WithPolicyAssignmentId,
                DefinitionStages.WithPolicyDefinitionReferenceId,
                DefinitionStages.WithResourceDiscoveryMode,
                DefinitionStages.WithFilters,
                DefinitionStages.WithResourceCount,
                DefinitionStages.WithParallelDeployments,
                DefinitionStages.WithFailureThreshold {
            /**
             * Executes the create request.
             *
             * @return the created resource.
             */
            Remediation create();

            /**
             * Executes the create request.
             *
             * @param context The context to associate with this operation.
             * @return the created resource.
             */
            Remediation create(Context context);
        }
        /** The stage of the Remediation definition allowing to specify policyAssignmentId. */
        interface WithPolicyAssignmentId {
            /**
             * Specifies the policyAssignmentId property: The resource ID of the policy assignment that should be
             * remediated..
             *
             * @param policyAssignmentId The resource ID of the policy assignment that should be remediated.
             * @return the next definition stage.
             */
            WithCreate withPolicyAssignmentId(String policyAssignmentId);
        }
        /** The stage of the Remediation definition allowing to specify policyDefinitionReferenceId. */
        interface WithPolicyDefinitionReferenceId {
            /**
             * Specifies 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 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 next definition stage.
             */
            WithCreate withPolicyDefinitionReferenceId(String policyDefinitionReferenceId);
        }
        /** The stage of the Remediation definition allowing to specify resourceDiscoveryMode. */
        interface WithResourceDiscoveryMode {
            /**
             * Specifies the resourceDiscoveryMode property: The way resources to remediate are discovered. Defaults to
             * ExistingNonCompliant if not specified..
             *
             * @param resourceDiscoveryMode The way resources to remediate are discovered. Defaults to
             *     ExistingNonCompliant if not specified.
             * @return the next definition stage.
             */
            WithCreate withResourceDiscoveryMode(ResourceDiscoveryMode resourceDiscoveryMode);
        }
        /** The stage of the Remediation definition allowing to specify filters. */
        interface WithFilters {
            /**
             * Specifies the filters property: The filters that will be applied to determine which resources to
             * remediate..
             *
             * @param filters The filters that will be applied to determine which resources to remediate.
             * @return the next definition stage.
             */
            WithCreate withFilters(RemediationFilters filters);
        }
        /** The stage of the Remediation definition allowing to specify resourceCount. */
        interface WithResourceCount {
            /**
             * Specifies 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 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 next definition stage.
             */
            WithCreate withResourceCount(Integer resourceCount);
        }
        /** The stage of the Remediation definition allowing to specify parallelDeployments. */
        interface WithParallelDeployments {
            /**
             * Specifies 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 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 next definition stage.
             */
            WithCreate withParallelDeployments(Integer parallelDeployments);
        }
        /** The stage of the Remediation definition allowing to specify failureThreshold. */
        interface WithFailureThreshold {
            /**
             * Specifies the failureThreshold property: The remediation failure threshold settings.
             *
             * @param failureThreshold The remediation failure threshold settings.
             * @return the next definition stage.
             */
            WithCreate withFailureThreshold(RemediationPropertiesFailureThreshold failureThreshold);
        }
    }
    /**
     * Begins update for the Remediation resource.
     *
     * @return the stage of resource update.
     */
    Remediation.Update update();

    /** The template for Remediation update. */
    interface Update
        extends UpdateStages.WithPolicyAssignmentId,
            UpdateStages.WithPolicyDefinitionReferenceId,
            UpdateStages.WithResourceDiscoveryMode,
            UpdateStages.WithFilters,
            UpdateStages.WithResourceCount,
            UpdateStages.WithParallelDeployments,
            UpdateStages.WithFailureThreshold {
        /**
         * Executes the update request.
         *
         * @return the updated resource.
         */
        Remediation apply();

        /**
         * Executes the update request.
         *
         * @param context The context to associate with this operation.
         * @return the updated resource.
         */
        Remediation apply(Context context);
    }
    /** The Remediation update stages. */
    interface UpdateStages {
        /** The stage of the Remediation update allowing to specify policyAssignmentId. */
        interface WithPolicyAssignmentId {
            /**
             * Specifies the policyAssignmentId property: The resource ID of the policy assignment that should be
             * remediated..
             *
             * @param policyAssignmentId The resource ID of the policy assignment that should be remediated.
             * @return the next definition stage.
             */
            Update withPolicyAssignmentId(String policyAssignmentId);
        }
        /** The stage of the Remediation update allowing to specify policyDefinitionReferenceId. */
        interface WithPolicyDefinitionReferenceId {
            /**
             * Specifies 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 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 next definition stage.
             */
            Update withPolicyDefinitionReferenceId(String policyDefinitionReferenceId);
        }
        /** The stage of the Remediation update allowing to specify resourceDiscoveryMode. */
        interface WithResourceDiscoveryMode {
            /**
             * Specifies the resourceDiscoveryMode property: The way resources to remediate are discovered. Defaults to
             * ExistingNonCompliant if not specified..
             *
             * @param resourceDiscoveryMode The way resources to remediate are discovered. Defaults to
             *     ExistingNonCompliant if not specified.
             * @return the next definition stage.
             */
            Update withResourceDiscoveryMode(ResourceDiscoveryMode resourceDiscoveryMode);
        }
        /** The stage of the Remediation update allowing to specify filters. */
        interface WithFilters {
            /**
             * Specifies the filters property: The filters that will be applied to determine which resources to
             * remediate..
             *
             * @param filters The filters that will be applied to determine which resources to remediate.
             * @return the next definition stage.
             */
            Update withFilters(RemediationFilters filters);
        }
        /** The stage of the Remediation update allowing to specify resourceCount. */
        interface WithResourceCount {
            /**
             * Specifies 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 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 next definition stage.
             */
            Update withResourceCount(Integer resourceCount);
        }
        /** The stage of the Remediation update allowing to specify parallelDeployments. */
        interface WithParallelDeployments {
            /**
             * Specifies 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 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 next definition stage.
             */
            Update withParallelDeployments(Integer parallelDeployments);
        }
        /** The stage of the Remediation update allowing to specify failureThreshold. */
        interface WithFailureThreshold {
            /**
             * Specifies the failureThreshold property: The remediation failure threshold settings.
             *
             * @param failureThreshold The remediation failure threshold settings.
             * @return the next definition stage.
             */
            Update withFailureThreshold(RemediationPropertiesFailureThreshold failureThreshold);
        }
    }
    /**
     * Refreshes the resource to sync with Azure.
     *
     * @return the refreshed resource.
     */
    Remediation refresh();

    /**
     * Refreshes the resource to sync with Azure.
     *
     * @param context The context to associate with this operation.
     * @return the refreshed resource.
     */
    Remediation refresh(Context context);

    /**
     * Gets all deployments for a remediation at resource group scope.
     *
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return all deployments for a remediation at resource group scope as paginated response with {@link
     *     PagedIterable}.
     */
    PagedIterable<RemediationDeployment> listDeploymentsAtResourceGroup();

    /**
     * Gets all deployments for a remediation at resource group scope.
     *
     * @param top Maximum number of records to return.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return all deployments for a remediation at resource group scope as paginated response with {@link
     *     PagedIterable}.
     */
    PagedIterable<RemediationDeployment> listDeploymentsAtResourceGroup(Integer top, Context context);

    /**
     * Cancels a remediation at resource group scope.
     *
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the remediation definition along with {@link Response}.
     */
    Response<Remediation> cancelAtResourceGroupWithResponse(Context context);

    /**
     * Cancels a remediation at resource group scope.
     *
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the remediation definition.
     */
    Remediation cancelAtResourceGroup();
}
