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

/**
 * DPM workload-specifc job object.
 *
 * @extends models['Job']
 */
class DpmJob extends models['Job'] {
  /**
   * Create a DpmJob.
   * @member {moment.duration} [duration] Time elapsed for job.
   * @member {string} [dpmServerName] DPM server name managing the backup item
   * or backup job.
   * @member {string} [containerName] Name of cluster/server protecting current
   * backup item, if any.
   * @member {string} [containerType] Type of container.
   * @member {string} [workloadType] Type of backup item.
   * @member {array} [actionsInfo] The state/actions applicable on this job
   * like cancel/retry.
   * @member {array} [errorDetails] The errors.
   * @member {object} [extendedInfo] Additional information for this job.
   * @member {array} [extendedInfo.tasksList] List of tasks associated with
   * this job.
   * @member {object} [extendedInfo.propertyBag] The job properties.
   * @member {string} [extendedInfo.dynamicErrorMessage] Non localized error
   * message on job execution.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of DpmJob
   *
   * @returns {object} metadata of DpmJob
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'DpmJob',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'jobType',
          clientName: 'jobType'
        },
        uberParent: 'Job',
        className: 'DpmJob',
        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'
            }
          },
          dpmServerName: {
            required: false,
            serializedName: 'dpmServerName',
            type: {
              name: 'String'
            }
          },
          containerName: {
            required: false,
            serializedName: 'containerName',
            type: {
              name: 'String'
            }
          },
          containerType: {
            required: false,
            serializedName: 'containerType',
            type: {
              name: 'String'
            }
          },
          workloadType: {
            required: false,
            serializedName: 'workloadType',
            type: {
              name: 'String'
            }
          },
          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: 'DpmErrorInfoElementType',
                  type: {
                    name: 'Composite',
                    className: 'DpmErrorInfo'
                  }
              }
            }
          },
          extendedInfo: {
            required: false,
            serializedName: 'extendedInfo',
            type: {
              name: 'Composite',
              className: 'DpmJobExtendedInfo'
            }
          }
        }
      }
    };
  }
}

module.exports = DpmJob;
