/*
 * 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');

/**
 * Azure storage specific job.
 *
 * @extends models['Job']
 */
class AzureWorkloadJob extends models['Job'] {
  /**
   * Create a AzureWorkloadJob.
   * @member {string} [workloadType] Workload type of the job
   * @member {moment.duration} [duration] Time elapsed during the execution of
   * this job.
   * @member {array} [actionsInfo] Gets or sets the state/actions applicable on
   * this job like cancel/retry.
   * @member {array} [errorDetails] Error details on execution of this job.
   * @member {object} [extendedInfo] Additional information about the job.
   * @member {array} [extendedInfo.tasksList] List of tasks for this job
   * @member {object} [extendedInfo.propertyBag] Job properties.
   * @member {string} [extendedInfo.dynamicErrorMessage] Non localized error
   * message on job execution.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of AzureWorkloadJob
   *
   * @returns {object} metadata of AzureWorkloadJob
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'AzureWorkloadJob',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'jobType',
          clientName: 'jobType'
        },
        uberParent: 'Job',
        className: 'AzureWorkloadJob',
        modelProperties: {
          entityFriendlyName: {
            required: false,
            serializedName: 'entityFriendlyName',
            type: {
              name: 'String'
            }
          },
          backupManagementType: {
            required: false,
            serializedName: 'backupManagementType',
            type: {
              name: 'String'
            }
          },
          operation: {
            required: false,
            serializedName: 'operation',
            type: {
              name: 'String'
            }
          },
          status: {
            required: false,
            serializedName: 'status',
            type: {
              name: 'String'
            }
          },
          startTime: {
            required: false,
            serializedName: 'startTime',
            type: {
              name: 'DateTime'
            }
          },
          endTime: {
            required: false,
            serializedName: 'endTime',
            type: {
              name: 'DateTime'
            }
          },
          activityId: {
            required: false,
            serializedName: 'activityId',
            type: {
              name: 'String'
            }
          },
          jobType: {
            required: true,
            serializedName: 'jobType',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          workloadType: {
            required: false,
            serializedName: 'workloadType',
            type: {
              name: 'String'
            }
          },
          duration: {
            required: false,
            serializedName: 'duration',
            type: {
              name: 'TimeSpan'
            }
          },
          actionsInfo: {
            required: false,
            serializedName: 'actionsInfo',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'JobSupportedActionElementType',
                  type: {
                    name: 'Enum',
                    allowedValues: [ 'Invalid', 'Cancellable', 'Retriable' ]
                  }
              }
            }
          },
          errorDetails: {
            required: false,
            serializedName: 'errorDetails',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'AzureWorkloadErrorInfoElementType',
                  type: {
                    name: 'Composite',
                    className: 'AzureWorkloadErrorInfo'
                  }
              }
            }
          },
          extendedInfo: {
            required: false,
            serializedName: 'extendedInfo',
            type: {
              name: 'Composite',
              className: 'AzureWorkloadJobExtendedInfo'
            }
          }
        }
      }
    };
  }
}

module.exports = AzureWorkloadJob;
