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

package com.azure.resourcemanager.security.models;

import com.azure.core.http.rest.Response;
import com.azure.core.management.Region;
import com.azure.core.util.Context;
import com.azure.resourcemanager.security.fluent.models.AutomationInner;
import java.util.List;
import java.util.Map;

/** An immutable client-side representation of Automation. */
public interface Automation {
    /**
     * 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 location property: The geo-location where the resource lives.
     *
     * @return the location value.
     */
    String location();

    /**
     * Gets the tags property: Resource tags.
     *
     * @return the tags value.
     */
    Map<String, String> tags();

    /**
     * Gets the description property: The security automation description.
     *
     * @return the description value.
     */
    String description();

    /**
     * Gets the isEnabled property: Indicates whether the security automation is enabled.
     *
     * @return the isEnabled value.
     */
    Boolean isEnabled();

    /**
     * Gets the scopes property: A collection of scopes on which the security automations logic is applied. Supported
     * scopes are the subscription itself or a resource group under that subscription. The automation will only apply on
     * defined scopes.
     *
     * @return the scopes value.
     */
    List<AutomationScope> scopes();

    /**
     * Gets the sources property: A collection of the source event types which evaluate the security automation set of
     * rules.
     *
     * @return the sources value.
     */
    List<AutomationSource> sources();

    /**
     * Gets the actions property: A collection of the actions which are triggered if all the configured rules
     * evaluations, within at least one rule set, are true.
     *
     * @return the actions value.
     */
    List<AutomationAction> actions();

    /**
     * Gets the region of the resource.
     *
     * @return the region of the resource.
     */
    Region region();

    /**
     * Gets the name of the resource region.
     *
     * @return the name of the resource region.
     */
    String regionName();

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

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

    /** The entirety of the Automation definition. */
    interface Definition
        extends DefinitionStages.Blank,
            DefinitionStages.WithLocation,
            DefinitionStages.WithResourceGroup,
            DefinitionStages.WithCreate {
    }
    /** The Automation definition stages. */
    interface DefinitionStages {
        /** The first stage of the Automation definition. */
        interface Blank extends WithLocation {
        }
        /** The stage of the Automation definition allowing to specify location. */
        interface WithLocation {
            /**
             * Specifies the region for the resource.
             *
             * @param location The geo-location where the resource lives.
             * @return the next definition stage.
             */
            WithResourceGroup withRegion(Region location);

            /**
             * Specifies the region for the resource.
             *
             * @param location The geo-location where the resource lives.
             * @return the next definition stage.
             */
            WithResourceGroup withRegion(String location);
        }
        /** The stage of the Automation definition allowing to specify parent resource. */
        interface WithResourceGroup {
            /**
             * Specifies resourceGroupName.
             *
             * @param resourceGroupName The name of the resource group within the user's subscription. The name is case
             *     insensitive.
             * @return the next definition stage.
             */
            WithCreate withExistingResourceGroup(String resourceGroupName);
        }
        /**
         * The stage of the Automation 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.WithTags,
                DefinitionStages.WithDescription,
                DefinitionStages.WithIsEnabled,
                DefinitionStages.WithScopes,
                DefinitionStages.WithSources,
                DefinitionStages.WithActions {
            /**
             * Executes the create request.
             *
             * @return the created resource.
             */
            Automation create();

            /**
             * Executes the create request.
             *
             * @param context The context to associate with this operation.
             * @return the created resource.
             */
            Automation create(Context context);
        }
        /** The stage of the Automation definition allowing to specify tags. */
        interface WithTags {
            /**
             * Specifies the tags property: Resource tags..
             *
             * @param tags Resource tags.
             * @return the next definition stage.
             */
            WithCreate withTags(Map<String, String> tags);
        }
        /** The stage of the Automation definition allowing to specify description. */
        interface WithDescription {
            /**
             * Specifies the description property: The security automation description..
             *
             * @param description The security automation description.
             * @return the next definition stage.
             */
            WithCreate withDescription(String description);
        }
        /** The stage of the Automation definition allowing to specify isEnabled. */
        interface WithIsEnabled {
            /**
             * Specifies the isEnabled property: Indicates whether the security automation is enabled..
             *
             * @param isEnabled Indicates whether the security automation is enabled.
             * @return the next definition stage.
             */
            WithCreate withIsEnabled(Boolean isEnabled);
        }
        /** The stage of the Automation definition allowing to specify scopes. */
        interface WithScopes {
            /**
             * Specifies the scopes property: A collection of scopes on which the security automations logic is applied.
             * Supported scopes are the subscription itself or a resource group under that subscription. The automation
             * will only apply on defined scopes..
             *
             * @param scopes A collection of scopes on which the security automations logic is applied. Supported scopes
             *     are the subscription itself or a resource group under that subscription. The automation will only
             *     apply on defined scopes.
             * @return the next definition stage.
             */
            WithCreate withScopes(List<AutomationScope> scopes);
        }
        /** The stage of the Automation definition allowing to specify sources. */
        interface WithSources {
            /**
             * Specifies the sources property: A collection of the source event types which evaluate the security
             * automation set of rules..
             *
             * @param sources A collection of the source event types which evaluate the security automation set of
             *     rules.
             * @return the next definition stage.
             */
            WithCreate withSources(List<AutomationSource> sources);
        }
        /** The stage of the Automation definition allowing to specify actions. */
        interface WithActions {
            /**
             * Specifies the actions property: A collection of the actions which are triggered if all the configured
             * rules evaluations, within at least one rule set, are true..
             *
             * @param actions A collection of the actions which are triggered if all the configured rules evaluations,
             *     within at least one rule set, are true.
             * @return the next definition stage.
             */
            WithCreate withActions(List<AutomationAction> actions);
        }
    }
    /**
     * Begins update for the Automation resource.
     *
     * @return the stage of resource update.
     */
    Automation.Update update();

    /** The template for Automation update. */
    interface Update
        extends UpdateStages.WithTags,
            UpdateStages.WithDescription,
            UpdateStages.WithIsEnabled,
            UpdateStages.WithScopes,
            UpdateStages.WithSources,
            UpdateStages.WithActions {
        /**
         * Executes the update request.
         *
         * @return the updated resource.
         */
        Automation apply();

        /**
         * Executes the update request.
         *
         * @param context The context to associate with this operation.
         * @return the updated resource.
         */
        Automation apply(Context context);
    }
    /** The Automation update stages. */
    interface UpdateStages {
        /** The stage of the Automation update allowing to specify tags. */
        interface WithTags {
            /**
             * Specifies the tags property: Resource tags..
             *
             * @param tags Resource tags.
             * @return the next definition stage.
             */
            Update withTags(Map<String, String> tags);
        }
        /** The stage of the Automation update allowing to specify description. */
        interface WithDescription {
            /**
             * Specifies the description property: The security automation description..
             *
             * @param description The security automation description.
             * @return the next definition stage.
             */
            Update withDescription(String description);
        }
        /** The stage of the Automation update allowing to specify isEnabled. */
        interface WithIsEnabled {
            /**
             * Specifies the isEnabled property: Indicates whether the security automation is enabled..
             *
             * @param isEnabled Indicates whether the security automation is enabled.
             * @return the next definition stage.
             */
            Update withIsEnabled(Boolean isEnabled);
        }
        /** The stage of the Automation update allowing to specify scopes. */
        interface WithScopes {
            /**
             * Specifies the scopes property: A collection of scopes on which the security automations logic is applied.
             * Supported scopes are the subscription itself or a resource group under that subscription. The automation
             * will only apply on defined scopes..
             *
             * @param scopes A collection of scopes on which the security automations logic is applied. Supported scopes
             *     are the subscription itself or a resource group under that subscription. The automation will only
             *     apply on defined scopes.
             * @return the next definition stage.
             */
            Update withScopes(List<AutomationScope> scopes);
        }
        /** The stage of the Automation update allowing to specify sources. */
        interface WithSources {
            /**
             * Specifies the sources property: A collection of the source event types which evaluate the security
             * automation set of rules..
             *
             * @param sources A collection of the source event types which evaluate the security automation set of
             *     rules.
             * @return the next definition stage.
             */
            Update withSources(List<AutomationSource> sources);
        }
        /** The stage of the Automation update allowing to specify actions. */
        interface WithActions {
            /**
             * Specifies the actions property: A collection of the actions which are triggered if all the configured
             * rules evaluations, within at least one rule set, are true..
             *
             * @param actions A collection of the actions which are triggered if all the configured rules evaluations,
             *     within at least one rule set, are true.
             * @return the next definition stage.
             */
            Update withActions(List<AutomationAction> actions);
        }
    }
    /**
     * Refreshes the resource to sync with Azure.
     *
     * @return the refreshed resource.
     */
    Automation refresh();

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

    /**
     * Validates the security automation model before create or update. Any validation errors are returned to the
     * client.
     *
     * @param automation The security automation resource.
     * @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 security automation model state property bag along with {@link Response}.
     */
    Response<AutomationValidationStatus> validateWithResponse(AutomationInner automation, Context context);

    /**
     * Validates the security automation model before create or update. Any validation errors are returned to the
     * client.
     *
     * @param automation The security automation resource.
     * @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 security automation model state property bag.
     */
    AutomationValidationStatus validate(AutomationInner automation);
}
