/*
 * 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 VM workload-specific protected item.
 *
 * @extends models['ProtectedItem']
 */
class AzureVmWorkloadProtectedItem extends models['ProtectedItem'] {
  /**
   * Create a AzureVmWorkloadProtectedItem.
   * @member {string} [friendlyName] Friendly name of the DB represented by
   * this backup item.
   * @member {string} [serverName] Host/Cluster Name for instance or AG
   * @member {string} [parentName] Parent name of the DB such as Instance or
   * Availability Group.
   * @member {string} [parentType] Parent type of protected item, example: for
   * a DB, standalone server or distributed
   * @member {string} [protectionStatus] Backup status of this backup item.
   * @member {string} [protectionState] Backup state of this backup item.
   * Possible values include: 'Invalid', 'IRPending', 'Protected',
   * 'ProtectionError', 'ProtectionStopped', 'ProtectionPaused'
   * @member {string} [lastBackupStatus] Last backup operation status. Possible
   * values: Healthy, Unhealthy. Possible values include: 'Invalid', 'Healthy',
   * 'Unhealthy', 'IRPending'
   * @member {date} [lastBackupTime] Timestamp of the last backup operation on
   * this backup item.
   * @member {object} [lastBackupErrorDetail] Error details in last backup
   * @member {string} [lastBackupErrorDetail.code] Error code.
   * @member {string} [lastBackupErrorDetail.message] Error Message related to
   * the Code.
   * @member {array} [lastBackupErrorDetail.recommendations] List of
   * recommendation strings.
   * @member {string} [protectedItemDataSourceId] Data ID of the protected
   * item.
   * @member {string} [protectedItemHealthStatus] Health status of the backup
   * item, evaluated based on last heartbeat received. Possible values include:
   * 'Invalid', 'Healthy', 'Unhealthy', 'NotReachable', 'IRPending'
   * @member {object} [extendedInfo] Additional information for this backup
   * item.
   * @member {date} [extendedInfo.oldestRecoveryPoint] The oldest backup copy
   * available for this backup item.
   * @member {number} [extendedInfo.recoveryPointCount] Number of backup copies
   * available for this backup item.
   * @member {string} [extendedInfo.policyState] Indicates consistency of
   * policy object and policy applied to this backup item.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of AzureVmWorkloadProtectedItem
   *
   * @returns {object} metadata of AzureVmWorkloadProtectedItem
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'AzureVmWorkloadProtectedItem',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'protectedItemType',
          clientName: 'protectedItemType'
        },
        uberParent: 'ProtectedItem',
        className: 'AzureVmWorkloadProtectedItem',
        modelProperties: {
          backupManagementType: {
            required: false,
            serializedName: 'backupManagementType',
            type: {
              name: 'String'
            }
          },
          workloadType: {
            required: false,
            serializedName: 'workloadType',
            type: {
              name: 'String'
            }
          },
          containerName: {
            required: false,
            serializedName: 'containerName',
            type: {
              name: 'String'
            }
          },
          sourceResourceId: {
            required: false,
            serializedName: 'sourceResourceId',
            type: {
              name: 'String'
            }
          },
          policyId: {
            required: false,
            serializedName: 'policyId',
            type: {
              name: 'String'
            }
          },
          lastRecoveryPoint: {
            required: false,
            serializedName: 'lastRecoveryPoint',
            type: {
              name: 'DateTime'
            }
          },
          backupSetName: {
            required: false,
            serializedName: 'backupSetName',
            type: {
              name: 'String'
            }
          },
          createMode: {
            required: false,
            serializedName: 'createMode',
            type: {
              name: 'String'
            }
          },
          protectedItemType: {
            required: true,
            serializedName: 'protectedItemType',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          friendlyName: {
            required: false,
            serializedName: 'friendlyName',
            type: {
              name: 'String'
            }
          },
          serverName: {
            required: false,
            serializedName: 'serverName',
            type: {
              name: 'String'
            }
          },
          parentName: {
            required: false,
            serializedName: 'parentName',
            type: {
              name: 'String'
            }
          },
          parentType: {
            required: false,
            serializedName: 'parentType',
            type: {
              name: 'String'
            }
          },
          protectionStatus: {
            required: false,
            serializedName: 'protectionStatus',
            type: {
              name: 'String'
            }
          },
          protectionState: {
            required: false,
            serializedName: 'protectionState',
            type: {
              name: 'String'
            }
          },
          lastBackupStatus: {
            required: false,
            serializedName: 'lastBackupStatus',
            type: {
              name: 'String'
            }
          },
          lastBackupTime: {
            required: false,
            serializedName: 'lastBackupTime',
            type: {
              name: 'DateTime'
            }
          },
          lastBackupErrorDetail: {
            required: false,
            serializedName: 'lastBackupErrorDetail',
            type: {
              name: 'Composite',
              className: 'ErrorDetail'
            }
          },
          protectedItemDataSourceId: {
            required: false,
            serializedName: 'protectedItemDataSourceId',
            type: {
              name: 'String'
            }
          },
          protectedItemHealthStatus: {
            required: false,
            serializedName: 'protectedItemHealthStatus',
            type: {
              name: 'String'
            }
          },
          extendedInfo: {
            required: false,
            serializedName: 'extendedInfo',
            type: {
              name: 'Composite',
              className: 'AzureVmWorkloadProtectedItemExtendedInfo'
            }
          }
        }
      }
    };
  }
}

module.exports = AzureVmWorkloadProtectedItem;
