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

/**
 * Base class for backup items.
 *
 * @extends models['ProtectedItem']
 */
class GenericProtectedItem extends models['ProtectedItem'] {
  /**
   * Create a GenericProtectedItem.
   * @member {string} [friendlyName] Friendly name of the container.
   * @member {string} [policyState] Indicates consistency of policy object and
   * policy applied to this backup item.
   * @member {string} [protectionState] Backup state of this backup item.
   * Possible values include: 'Invalid', 'IRPending', 'Protected',
   * 'ProtectionError', 'ProtectionStopped', 'ProtectionPaused'
   * @member {number} [protectedItemId] Data Plane Service ID of the protected
   * item.
   * @member {object} [sourceAssociations] Loosely coupled (type, value)
   * associations (example - parent of a protected item)
   * @member {string} [fabricName] Name of this backup item's fabric.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of GenericProtectedItem
   *
   * @returns {object} metadata of GenericProtectedItem
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'GenericProtectedItem',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'protectedItemType',
          clientName: 'protectedItemType'
        },
        uberParent: 'ProtectedItem',
        className: 'GenericProtectedItem',
        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'
            }
          },
          policyState: {
            required: false,
            serializedName: 'policyState',
            type: {
              name: 'String'
            }
          },
          protectionState: {
            required: false,
            serializedName: 'protectionState',
            type: {
              name: 'String'
            }
          },
          protectedItemId: {
            required: false,
            serializedName: 'protectedItemId',
            type: {
              name: 'Number'
            }
          },
          sourceAssociations: {
            required: false,
            serializedName: 'sourceAssociations',
            type: {
              name: 'Dictionary',
              value: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          fabricName: {
            required: false,
            serializedName: 'fabricName',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = GenericProtectedItem;
