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

/**
 * A managed database resource.
 *
 * @extends models['TrackedResource']
 */
class ManagedDatabase extends models['TrackedResource'] {
  /**
   * Create a ManagedDatabase.
   * @property {string} [collation] Collation of the managed database.
   * @property {string} [status] Status of the database. Possible values
   * include: 'Online', 'Offline', 'Shutdown', 'Creating', 'Inaccessible',
   * 'Updating'
   * @property {date} [creationDate] Creation date of the database.
   * @property {date} [earliestRestorePoint] Earliest restore point in time for
   * point in time restore.
   * @property {date} [restorePointInTime] Conditional. If createMode is
   * PointInTimeRestore, this value is required. Specifies the point in time
   * (ISO8601 format) of the source database that will be restored to create
   * the new database.
   * @property {string} [defaultSecondaryLocation] Geo paired region.
   * @property {string} [catalogCollation] Collation of the metadata catalog.
   * Possible values include: 'DATABASE_DEFAULT',
   * 'SQL_Latin1_General_CP1_CI_AS'
   * @property {string} [createMode] Managed database create mode.
   * PointInTimeRestore: Create a database by restoring a point in time backup
   * of an existing database. SourceDatabaseName, SourceManagedInstanceName and
   * PointInTime must be specified. RestoreExternalBackup: Create a database by
   * restoring from external backup files. Collation, StorageContainerUri and
   * StorageContainerSasToken must be specified. Recovery: Creates a database
   * by restoring a geo-replicated backup. RecoverableDatabaseId must be
   * specified as the recoverable database resource ID to restore. Possible
   * values include: 'Default', 'RestoreExternalBackup', 'PointInTimeRestore',
   * 'Recovery'
   * @property {string} [storageContainerUri] Conditional. If createMode is
   * RestoreExternalBackup, this value is required. Specifies the uri of the
   * storage container where backups for this restore are stored.
   * @property {string} [sourceDatabaseId] The resource identifier of the
   * source database associated with create operation of this database.
   * @property {string} [restorableDroppedDatabaseId] The restorable dropped
   * database resource id to restore when creating this database.
   * @property {string} [storageContainerSasToken] Conditional. If createMode
   * is RestoreExternalBackup, this value is required. Specifies the storage
   * container sas token.
   * @property {string} [failoverGroupId] Instance Failover Group resource
   * identifier that this managed database belongs to.
   * @property {string} [recoverableDatabaseId] The resource identifier of the
   * recoverable database associated with create operation of this database.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of ManagedDatabase
   *
   * @returns {object} metadata of ManagedDatabase
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ManagedDatabase',
      type: {
        name: 'Composite',
        className: 'ManagedDatabase',
        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'
            }
          },
          location: {
            required: true,
            serializedName: 'location',
            type: {
              name: 'String'
            }
          },
          tags: {
            required: false,
            serializedName: 'tags',
            type: {
              name: 'Dictionary',
              value: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          collation: {
            required: false,
            serializedName: 'properties.collation',
            type: {
              name: 'String'
            }
          },
          status: {
            required: false,
            readOnly: true,
            serializedName: 'properties.status',
            type: {
              name: 'String'
            }
          },
          creationDate: {
            required: false,
            readOnly: true,
            serializedName: 'properties.creationDate',
            type: {
              name: 'DateTime'
            }
          },
          earliestRestorePoint: {
            required: false,
            readOnly: true,
            serializedName: 'properties.earliestRestorePoint',
            type: {
              name: 'DateTime'
            }
          },
          restorePointInTime: {
            required: false,
            serializedName: 'properties.restorePointInTime',
            type: {
              name: 'DateTime'
            }
          },
          defaultSecondaryLocation: {
            required: false,
            readOnly: true,
            serializedName: 'properties.defaultSecondaryLocation',
            type: {
              name: 'String'
            }
          },
          catalogCollation: {
            required: false,
            serializedName: 'properties.catalogCollation',
            type: {
              name: 'String'
            }
          },
          createMode: {
            required: false,
            serializedName: 'properties.createMode',
            type: {
              name: 'String'
            }
          },
          storageContainerUri: {
            required: false,
            serializedName: 'properties.storageContainerUri',
            type: {
              name: 'String'
            }
          },
          sourceDatabaseId: {
            required: false,
            serializedName: 'properties.sourceDatabaseId',
            type: {
              name: 'String'
            }
          },
          restorableDroppedDatabaseId: {
            required: false,
            serializedName: 'properties.restorableDroppedDatabaseId',
            type: {
              name: 'String'
            }
          },
          storageContainerSasToken: {
            required: false,
            serializedName: 'properties.storageContainerSasToken',
            type: {
              name: 'String'
            }
          },
          failoverGroupId: {
            required: false,
            readOnly: true,
            serializedName: 'properties.failoverGroupId',
            type: {
              name: 'String'
            }
          },
          recoverableDatabaseId: {
            required: false,
            serializedName: 'properties.recoverableDatabaseId',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = ManagedDatabase;
