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

/**
 * Job Resource.
 *
 * @extends models['Resource']
 */
class JobResource extends models['Resource'] {
  /**
   * Create a JobResource.
   * @member {boolean} [isCancellable] Describes whether the job is cancellable
   * or not.
   * @member {boolean} [isDeletable] Describes whether the job is deletable or
   * not.
   * @member {boolean} [isShippingAddressEditable] Describes whether the
   * shipping address is editable or not.
   * @member {string} [status] Name of the stage which is in progress. Possible
   * values include: 'DeviceOrdered', 'DevicePrepared', 'Dispatched',
   * 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed',
   * 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer',
   * 'Failed_IssueDetectedAtAzureDC', 'Aborted'
   * @member {date} [startTime] Time at which the job was started in UTC ISO
   * 8601 format.
   * @member {object} [error] Top level error for the job.
   * @member {string} [error.code] Error code that can be used to
   * programmatically identify the error.
   * @member {string} [error.message] Describes the error in detail and
   * provides debugging information.
   * @member {object} [details] Details of a job run. This field will only be
   * sent for expand details filter.
   * @member {number} [details.expectedDataSizeInTeraBytes] The expected size
   * of the data, which needs to be transfered in this job, in tera bytes.
   * @member {array} [details.jobStages] List of stages that run in the job.
   * @member {object} [details.contactDetails] Contact details for notification
   * and shipping.
   * @member {string} [details.contactDetails.contactName] Contact name of the
   * person.
   * @member {string} [details.contactDetails.phone] Phone number of the
   * contact person.
   * @member {string} [details.contactDetails.phoneExtension] Phone extension
   * number of the contact person.
   * @member {string} [details.contactDetails.mobile] Mobile number of the
   * contact person.
   * @member {array} [details.contactDetails.emailList] List of Email-ids to be
   * notified about job progress.
   * @member {array} [details.contactDetails.notificationPreference]
   * Notification preference for a job stage.
   * @member {object} [details.shippingAddress] Shipping address of the
   * customer.
   * @member {string} [details.shippingAddress.streetAddress1] Street Address
   * line 1.
   * @member {string} [details.shippingAddress.streetAddress2] Street Address
   * line 2.
   * @member {string} [details.shippingAddress.streetAddress3] Street Address
   * line 3.
   * @member {string} [details.shippingAddress.city] Name of the City.
   * @member {string} [details.shippingAddress.stateOrProvince] Name of the
   * State or Province.
   * @member {string} [details.shippingAddress.country] Name of the Country.
   * @member {string} [details.shippingAddress.postalCode] Postal code.
   * @member {string} [details.shippingAddress.zipExtendedCode] Extended Zip
   * Code.
   * @member {string} [details.shippingAddress.companyName] Name of the
   * company.
   * @member {string} [details.shippingAddress.addressType] Type of address.
   * Possible values include: 'None', 'Residential', 'Commercial'
   * @member {object} [details.deliveryPackage] Delivery package shipping
   * details.
   * @member {string} [details.deliveryPackage.carrierName] Name of the
   * carrier.
   * @member {string} [details.deliveryPackage.trackingId] Tracking Id of
   * shipment.
   * @member {string} [details.deliveryPackage.trackingUrl] Url where shipment
   * can be tracked.
   * @member {object} [details.returnPackage] Return package shipping details.
   * @member {string} [details.returnPackage.carrierName] Name of the carrier.
   * @member {string} [details.returnPackage.trackingId] Tracking Id of
   * shipment.
   * @member {string} [details.returnPackage.trackingUrl] Url where shipment
   * can be tracked.
   * @member {array} [details.destinationAccountDetails] Destination account
   * details.
   * @member {array} [details.errorDetails] Error details for failure. This is
   * optional.
   * @member {object} [details.preferences] Preferences for the order.
   * @member {array} [details.preferences.preferredDataCenterRegion]
   * @member {array} [details.copyLogDetails] List of copy log details.
   * @member {string} [details.reverseShipmentLabelSasKey] Shared access key to
   * download the return shipment label
   * @member {string} [details.chainOfCustodySasKey] Shared access key to
   * download the chain of custody logs
   * @member {string} [details.jobDetailsType] Polymorphic Discriminator
   * @member {string} [cancellationReason] Reason for cancellation.
   * @member {string} [name] Name of the object.
   * @member {string} [id] Id of the object.
   * @member {string} [type] Type of the object.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of JobResource
   *
   * @returns {object} metadata of JobResource
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'JobResource',
      type: {
        name: 'Composite',
        className: 'JobResource',
        modelProperties: {
          location: {
            required: true,
            serializedName: 'location',
            type: {
              name: 'String'
            }
          },
          tags: {
            required: false,
            serializedName: 'tags',
            type: {
              name: 'Dictionary',
              value: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          sku: {
            required: true,
            serializedName: 'sku',
            type: {
              name: 'Composite',
              className: 'Sku'
            }
          },
          isCancellable: {
            required: false,
            readOnly: true,
            serializedName: 'properties.isCancellable',
            type: {
              name: 'Boolean'
            }
          },
          isDeletable: {
            required: false,
            readOnly: true,
            serializedName: 'properties.isDeletable',
            type: {
              name: 'Boolean'
            }
          },
          isShippingAddressEditable: {
            required: false,
            readOnly: true,
            serializedName: 'properties.isShippingAddressEditable',
            type: {
              name: 'Boolean'
            }
          },
          status: {
            required: false,
            readOnly: true,
            serializedName: 'properties.status',
            type: {
              name: 'Enum',
              allowedValues: [ 'DeviceOrdered', 'DevicePrepared', 'Dispatched', 'Delivered', 'PickedUp', 'AtAzureDC', 'DataCopy', 'Completed', 'CompletedWithErrors', 'Cancelled', 'Failed_IssueReportedAtCustomer', 'Failed_IssueDetectedAtAzureDC', 'Aborted' ]
            }
          },
          startTime: {
            required: false,
            readOnly: true,
            serializedName: 'properties.startTime',
            type: {
              name: 'DateTime'
            }
          },
          error: {
            required: false,
            readOnly: true,
            serializedName: 'properties.error',
            type: {
              name: 'Composite',
              className: 'ErrorModel'
            }
          },
          details: {
            required: false,
            serializedName: 'properties.details',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: 'jobDetailsType',
                clientName: 'jobDetailsType'
              },
              uberParent: 'JobDetails',
              className: 'JobDetails'
            }
          },
          cancellationReason: {
            required: false,
            readOnly: true,
            serializedName: 'properties.cancellationReason',
            type: {
              name: 'String'
            }
          },
          name: {
            required: false,
            readOnly: true,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          id: {
            required: false,
            readOnly: true,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          type: {
            required: false,
            readOnly: true,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = JobResource;
