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

package com.azure.resourcemanager.automation.models;

import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
import com.azure.resourcemanager.automation.fluent.models.JobInner;
import java.time.OffsetDateTime;
import java.util.Map;
import java.util.UUID;

/** An immutable client-side representation of Job. */
public interface Job {
    /**
     * 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 runbook property: Gets or sets the runbook.
     *
     * @return the runbook value.
     */
    RunbookAssociationProperty runbook();

    /**
     * Gets the startedBy property: Gets or sets the job started by.
     *
     * @return the startedBy value.
     */
    String startedBy();

    /**
     * Gets the runOn property: Gets or sets the runOn which specifies the group name where the job is to be executed.
     *
     * @return the runOn value.
     */
    String runOn();

    /**
     * Gets the jobId property: Gets or sets the id of the job.
     *
     * @return the jobId value.
     */
    UUID jobId();

    /**
     * Gets the creationTime property: Gets or sets the creation time of the job.
     *
     * @return the creationTime value.
     */
    OffsetDateTime creationTime();

    /**
     * Gets the status property: Gets or sets the status of the job.
     *
     * @return the status value.
     */
    JobStatus status();

    /**
     * Gets the statusDetails property: Gets or sets the status details of the job.
     *
     * @return the statusDetails value.
     */
    String statusDetails();

    /**
     * Gets the startTime property: Gets or sets the start time of the job.
     *
     * @return the startTime value.
     */
    OffsetDateTime startTime();

    /**
     * Gets the endTime property: Gets or sets the end time of the job.
     *
     * @return the endTime value.
     */
    OffsetDateTime endTime();

    /**
     * Gets the exception property: Gets or sets the exception of the job.
     *
     * @return the exception value.
     */
    String exception();

    /**
     * Gets the lastModifiedTime property: Gets or sets the last modified time of the job.
     *
     * @return the lastModifiedTime value.
     */
    OffsetDateTime lastModifiedTime();

    /**
     * Gets the lastStatusModifiedTime property: Gets or sets the last status modified time of the job.
     *
     * @return the lastStatusModifiedTime value.
     */
    OffsetDateTime lastStatusModifiedTime();

    /**
     * Gets the parameters property: Gets or sets the parameters of the job.
     *
     * @return the parameters value.
     */
    Map<String, String> parameters();

    /**
     * Gets the provisioningState property: The current provisioning state of the job.
     *
     * @return the provisioningState value.
     */
    JobProvisioningState provisioningState();

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

    /** The entirety of the Job definition. */
    interface Definition
        extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate {
    }
    /** The Job definition stages. */
    interface DefinitionStages {
        /** The first stage of the Job definition. */
        interface Blank extends WithParentResource {
        }
        /** The stage of the Job definition allowing to specify parent resource. */
        interface WithParentResource {
            /**
             * Specifies resourceGroupName, automationAccountName.
             *
             * @param resourceGroupName Name of an Azure Resource group.
             * @param automationAccountName The name of the automation account.
             * @return the next definition stage.
             */
            WithCreate withExistingAutomationAccount(String resourceGroupName, String automationAccountName);
        }
        /**
         * The stage of the Job 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.WithRunbook,
                DefinitionStages.WithParameters,
                DefinitionStages.WithRunOn,
                DefinitionStages.WithClientRequestId {
            /**
             * Executes the create request.
             *
             * @return the created resource.
             */
            Job create();

            /**
             * Executes the create request.
             *
             * @param context The context to associate with this operation.
             * @return the created resource.
             */
            Job create(Context context);
        }
        /** The stage of the Job definition allowing to specify runbook. */
        interface WithRunbook {
            /**
             * Specifies the runbook property: Gets or sets the runbook..
             *
             * @param runbook Gets or sets the runbook.
             * @return the next definition stage.
             */
            WithCreate withRunbook(RunbookAssociationProperty runbook);
        }
        /** The stage of the Job definition allowing to specify parameters. */
        interface WithParameters {
            /**
             * Specifies the parameters property: Gets or sets the parameters of the job..
             *
             * @param parameters Gets or sets the parameters of the job.
             * @return the next definition stage.
             */
            WithCreate withParameters(Map<String, String> parameters);
        }
        /** The stage of the Job definition allowing to specify runOn. */
        interface WithRunOn {
            /**
             * Specifies the runOn property: Gets or sets the runOn which specifies the group name where the job is to
             * be executed..
             *
             * @param runOn Gets or sets the runOn which specifies the group name where the job is to be executed.
             * @return the next definition stage.
             */
            WithCreate withRunOn(String runOn);
        }
        /** The stage of the Job definition allowing to specify clientRequestId. */
        interface WithClientRequestId {
            /**
             * Specifies the clientRequestId property: Identifies this specific client request..
             *
             * @param clientRequestId Identifies this specific client request.
             * @return the next definition stage.
             */
            WithCreate withClientRequestId(String clientRequestId);
        }
    }
    /**
     * Refreshes the resource to sync with Azure.
     *
     * @return the refreshed resource.
     */
    Job refresh();

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

    /**
     * Suspend the job identified by job name.
     *
     * @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.
     */
    void suspend();

    /**
     * Suspend the job identified by job name.
     *
     * @param clientRequestId Identifies this specific client request.
     * @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 {@link Response}.
     */
    Response<Void> suspendWithResponse(String clientRequestId, Context context);

    /**
     * Stop the job identified by jobName.
     *
     * @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.
     */
    void stop();

    /**
     * Stop the job identified by jobName.
     *
     * @param clientRequestId Identifies this specific client request.
     * @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 {@link Response}.
     */
    Response<Void> stopWithResponse(String clientRequestId, Context context);

    /**
     * Resume the job identified by jobName.
     *
     * @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.
     */
    void resume();

    /**
     * Resume the job identified by jobName.
     *
     * @param clientRequestId Identifies this specific client request.
     * @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 {@link Response}.
     */
    Response<Void> resumeWithResponse(String clientRequestId, Context context);
}
