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

/**
 * MAB workload-specific job.
 *
 * @extends models['Job']
 */
class MabJob extends models['Job'] {
  /**
   * Create a MabJob.
   * @member {moment.duration} [duration] Time taken by job to run.
   * @member {array} [actionsInfo] The state/actions applicable on jobs like
   * cancel/retry.
   * @member {string} [mabServerName] Name of server protecting the DS.
   * @member {string} [mabServerType] Server type of MAB container. Possible
   * values include: 'Invalid', 'Unknown', 'IaasVMContainer',
   * 'IaasVMServiceContainer', 'DPMContainer', 'AzureBackupServerContainer',
   * 'MABContainer', 'Cluster', 'AzureSqlContainer', 'Windows', 'VCenter',
   * 'VMAppContainer', 'SQLAGWorkLoadContainer', 'StorageContainer',
   * 'GenericContainer'
   * @member {string} [workloadType] Workload type of backup item. Possible
   * values include: 'Invalid', 'VM', 'FileFolder', 'AzureSqlDb', 'SQLDB',
   * 'Exchange', 'Sharepoint', 'VMwareVM', 'SystemState', 'Client',
   * 'GenericDataSource', 'SQLDataBase', 'AzureFileShare', 'SAPHanaDatabase'
   * @member {array} [errorDetails] The errors.
   * @member {object} [extendedInfo] Additional information on the job.
   * @member {array} [extendedInfo.tasksList] List of tasks for this job.
   * @member {object} [extendedInfo.propertyBag] The job properties.
   * @member {string} [extendedInfo.dynamicErrorMessage] Non localized error
   * message specific to this job.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of MabJob
   *
   * @returns {object} metadata of MabJob
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'MabJob',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'jobType',
          clientName: 'jobType'
        },
        uberParent: 'Job',
        className: 'MabJob',
        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'
            }
          },
          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' ]
                  }
              }
            }
          },
          mabServerName: {
            required: false,
            serializedName: 'mabServerName',
            type: {
              name: 'String'
            }
          },
          mabServerType: {
            required: false,
            serializedName: 'mabServerType',
            type: {
              name: 'String'
            }
          },
          workloadType: {
            required: false,
            serializedName: 'workloadType',
            type: {
              name: 'String'
            }
          },
          errorDetails: {
            required: false,
            serializedName: 'errorDetails',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'MabErrorInfoElementType',
                  type: {
                    name: 'Composite',
                    className: 'MabErrorInfo'
                  }
              }
            }
          },
          extendedInfo: {
            required: false,
            serializedName: 'extendedInfo',
            type: {
              name: 'Composite',
              className: 'MabJobExtendedInfo'
            }
          }
        }
      }
    };
  }
}

module.exports = MabJob;
