/*
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 *
 * Code generated by Microsoft (R) AutoRest Code Generator.
 * Changes may cause incorrect behavior and will be lost if the code is
 * regenerated.
 */

'use strict';

const models = require('./index');

/**
 * A job step.
 *
 * @extends models['ProxyResource']
 */
class JobStep extends models['ProxyResource'] {
  /**
   * Create a JobStep.
   * @property {number} [stepId] The job step's index within the job. If not
   * specified when creating the job step, it will be created as the last step.
   * If not specified when updating the job step, the step id is not modified.
   * @property {string} targetGroup The resource ID of the target group that
   * the job step will be executed on.
   * @property {string} credential The resource ID of the job credential that
   * will be used to connect to the targets.
   * @property {object} action The action payload of the job step.
   * @property {string} [action.type] Type of action being executed by the job
   * step. Possible values include: 'TSql'
   * @property {string} [action.source] The source of the action to execute.
   * Possible values include: 'Inline'
   * @property {string} [action.value] The action value, for example the text
   * of the T-SQL script to execute.
   * @property {object} [output] Output destination properties of the job step.
   * @property {string} [output.type] The output destination type. Possible
   * values include: 'SqlDatabase'
   * @property {uuid} [output.subscriptionId] The output destination
   * subscription id.
   * @property {string} [output.resourceGroupName] The output destination
   * resource group.
   * @property {string} [output.serverName] The output destination server name.
   * @property {string} [output.databaseName] The output destination database.
   * @property {string} [output.schemaName] The output destination schema.
   * @property {string} [output.tableName] The output destination table.
   * @property {string} [output.credential] The resource ID of the credential
   * to use to connect to the output destination.
   * @property {object} [executionOptions] Execution options for the job step.
   * @property {number} [executionOptions.timeoutSeconds] Execution timeout for
   * the job step.
   * @property {number} [executionOptions.retryAttempts] Maximum number of
   * times the job step will be reattempted if the first attempt fails.
   * @property {number} [executionOptions.initialRetryIntervalSeconds] Initial
   * delay between retries for job step execution.
   * @property {number} [executionOptions.maximumRetryIntervalSeconds] The
   * maximum amount of time to wait between retries for job step execution.
   * @property {number} [executionOptions.retryIntervalBackoffMultiplier] The
   * backoff multiplier for the time between retries.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of JobStep
   *
   * @returns {object} metadata of JobStep
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'JobStep',
      type: {
        name: 'Composite',
        className: 'JobStep',
        modelProperties: {
          id: {
            required: false,
            readOnly: true,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          name: {
            required: false,
            readOnly: true,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          type: {
            required: false,
            readOnly: true,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          },
          stepId: {
            required: false,
            serializedName: 'properties.stepId',
            type: {
              name: 'Number'
            }
          },
          targetGroup: {
            required: true,
            serializedName: 'properties.targetGroup',
            type: {
              name: 'String'
            }
          },
          credential: {
            required: true,
            serializedName: 'properties.credential',
            type: {
              name: 'String'
            }
          },
          action: {
            required: true,
            serializedName: 'properties.action',
            type: {
              name: 'Composite',
              className: 'JobStepAction'
            }
          },
          output: {
            required: false,
            serializedName: 'properties.output',
            type: {
              name: 'Composite',
              className: 'JobStepOutput'
            }
          },
          executionOptions: {
            required: false,
            serializedName: 'properties.executionOptions',
            type: {
              name: 'Composite',
              className: 'JobStepExecutionOptions'
            }
          }
        }
      }
    };
  }
}

module.exports = JobStep;
