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

/**
 * The job.
 *
 * @extends models['BaseModel']
 */
class Job extends models['BaseModel'] {
  /**
   * Create a Job.
   * @member {string} status The current status of the job. Possible values
   * include: 'Running', 'Succeeded', 'Failed', 'Canceled'
   * @member {date} [startTime] The UTC time at which the job was started.
   * @member {date} [endTime] The UTC time at which the job completed.
   * @member {number} percentComplete The percentage of the job that is already
   * complete.
   * @member {object} [error] The error details, if any, for the job.
   * @member {array} [error.errorDetails] The error details.
   * @member {string} [error.code] The error code intended for programmatic
   * access.
   * @member {string} [error.message] The error message intended to describe
   * the error in detail.
   * @member {string} jobType The type of the job. Possible values include:
   * 'ScheduledBackup', 'ManualBackup', 'RestoreBackup', 'CloneVolume',
   * 'FailoverVolumeContainers', 'CreateLocallyPinnedVolume', 'ModifyVolume',
   * 'InstallUpdates', 'SupportPackageLogs', 'CreateCloudAppliance'
   * @member {object} [dataStats] The data statistics properties of the job.
   * @member {number} [dataStats.totalData] The total bytes of data to be
   * processed, as part of the job.
   * @member {number} [dataStats.processedData] The number of bytes of data
   * processed till now, as part of the job.
   * @member {number} [dataStats.cloudData] The number of bytes of data written
   * to cloud, as part of the job.
   * @member {number} [dataStats.throughput] The average throughput of data
   * processed(bytes/sec), as part of the job.
   * @member {string} [entityLabel] The entity identifier for which the job
   * ran.
   * @member {string} [entityType] The entity type for which the job ran.
   * @member {array} [jobStages] The job stages.
   * @member {string} [deviceId] The device ID in which the job ran.
   * @member {boolean} [isCancellable] Represents whether the job is
   * cancellable or not.
   * @member {string} [backupType] The backup type (CloudSnapshot |
   * LocalSnapshot). Applicable only for backup jobs. Possible values include:
   * 'LocalSnapshot', 'CloudSnapshot'
   * @member {string} [sourceDeviceId] The source device ID of the failover
   * job.
   * @member {date} [backupPointInTime] The time of the backup used for the
   * failover.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of Job
   *
   * @returns {object} metadata of Job
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Job',
      type: {
        name: 'Composite',
        className: 'Job',
        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'
            }
          },
          kind: {
            required: false,
            serializedName: 'kind',
            type: {
              name: 'Enum',
              allowedValues: [ 'Series8000' ]
            }
          },
          status: {
            required: true,
            serializedName: 'status',
            type: {
              name: 'Enum',
              allowedValues: [ 'Running', 'Succeeded', 'Failed', 'Canceled' ]
            }
          },
          startTime: {
            required: false,
            serializedName: 'startTime',
            type: {
              name: 'DateTime'
            }
          },
          endTime: {
            required: false,
            serializedName: 'endTime',
            type: {
              name: 'DateTime'
            }
          },
          percentComplete: {
            required: true,
            serializedName: 'percentComplete',
            type: {
              name: 'Number'
            }
          },
          error: {
            required: false,
            serializedName: 'error',
            type: {
              name: 'Composite',
              className: 'JobErrorDetails'
            }
          },
          jobType: {
            required: true,
            serializedName: 'properties.jobType',
            type: {
              name: 'Enum',
              allowedValues: [ 'ScheduledBackup', 'ManualBackup', 'RestoreBackup', 'CloneVolume', 'FailoverVolumeContainers', 'CreateLocallyPinnedVolume', 'ModifyVolume', 'InstallUpdates', 'SupportPackageLogs', 'CreateCloudAppliance' ]
            }
          },
          dataStats: {
            required: false,
            serializedName: 'properties.dataStats',
            type: {
              name: 'Composite',
              className: 'DataStatistics'
            }
          },
          entityLabel: {
            required: false,
            serializedName: 'properties.entityLabel',
            type: {
              name: 'String'
            }
          },
          entityType: {
            required: false,
            serializedName: 'properties.entityType',
            type: {
              name: 'String'
            }
          },
          jobStages: {
            required: false,
            serializedName: 'properties.jobStages',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'JobStageElementType',
                  type: {
                    name: 'Composite',
                    className: 'JobStage'
                  }
              }
            }
          },
          deviceId: {
            required: false,
            serializedName: 'properties.deviceId',
            type: {
              name: 'String'
            }
          },
          isCancellable: {
            required: false,
            serializedName: 'properties.isCancellable',
            type: {
              name: 'Boolean'
            }
          },
          backupType: {
            required: false,
            serializedName: 'properties.backupType',
            type: {
              name: 'Enum',
              allowedValues: [ 'LocalSnapshot', 'CloudSnapshot' ]
            }
          },
          sourceDeviceId: {
            required: false,
            serializedName: 'properties.sourceDeviceId',
            type: {
              name: 'String'
            }
          },
          backupPointInTime: {
            required: false,
            serializedName: 'properties.backupPointInTime',
            type: {
              name: 'DateTime'
            }
          }
        }
      }
    };
  }
}

module.exports = Job;
