# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.

module Azure::SQL::Mgmt::V2017_03_01_preview
  module Models
    #
    # A database resource.
    #
    class Database < TrackedResource

      include MsRestAzure

      # @return [Sku] The name and tier of the SKU.
      attr_accessor :sku

      # @return [String] Kind of database. This is metadata used for the Azure
      # portal experience.
      attr_accessor :kind

      # @return [CreateMode] Specifies the mode of database creation.
      #
      # Default: regular database creation.
      #
      # Copy: creates a database as a copy of an existing database.
      # sourceDatabaseId must be specified as the resource ID of the source
      # database.
      #
      # Secondary: creates a database as a secondary replica of an existing
      # database. sourceDatabaseId must be specified as the resource ID of the
      # existing primary database.
      #
      # PointInTimeRestore: Creates a database by restoring a point in time
      # backup of an existing database. sourceDatabaseId must be specified as
      # the resource ID of the existing database, and restorePointInTime must
      # be specified.
      #
      # Recovery: Creates a database by restoring a geo-replicated backup.
      # sourceDatabaseId must be specified as the recoverable database resource
      # ID to restore.
      #
      # Restore: Creates a database by restoring a backup of a deleted
      # database. sourceDatabaseId must be specified. If sourceDatabaseId is
      # the database's original resource ID, then sourceDatabaseDeletionDate
      # must be specified. Otherwise sourceDatabaseId must be the restorable
      # dropped database resource ID and sourceDatabaseDeletionDate is ignored.
      # restorePointInTime may also be specified to restore from an earlier
      # point in time.
      #
      # RestoreLongTermRetentionBackup: Creates a database by restoring from a
      # long term retention vault. recoveryServicesRecoveryPointResourceId must
      # be specified as the recovery point resource ID.
      #
      # Copy, Secondary, and RestoreLongTermRetentionBackup are not supported
      # for DataWarehouse edition. Possible values include: 'Default', 'Copy',
      # 'Secondary', 'OnlineSecondary', 'PointInTimeRestore', 'Restore',
      # 'Recovery', 'RestoreExternalBackup', 'RestoreExternalBackupSecondary',
      # 'RestoreLongTermRetentionBackup'
      attr_accessor :create_mode

      # @return [String] The collation of the database.
      attr_accessor :collation

      # @return [Integer] The max size of the database expressed in bytes.
      attr_accessor :max_size_bytes

      # @return [SampleName] The name of the sample schema to apply when
      # creating this database. Possible values include: 'AdventureWorksLT',
      # 'WideWorldImportersStd', 'WideWorldImportersFull'
      attr_accessor :sample_name

      # @return [String] The resource identifier of the elastic pool containing
      # this database.
      attr_accessor :elastic_pool_id

      # @return [String] The resource identifier of the source database
      # associated with create operation of this database.
      attr_accessor :source_database_id

      # @return [DatabaseStatus] The status of the database. Possible values
      # include: 'Online', 'Restoring', 'RecoveryPending', 'Recovering',
      # 'Suspect', 'Offline', 'Standby', 'Shutdown', 'EmergencyMode',
      # 'AutoClosed', 'Copying', 'Creating', 'Inaccessible',
      # 'OfflineSecondary', 'Pausing', 'Paused', 'Resuming', 'Scaling'
      attr_accessor :status

      # @return The ID of the database.
      attr_accessor :database_id

      # @return [DateTime] The creation date of the database (ISO8601 format).
      attr_accessor :creation_date

      # @return [String] The current service level objective name of the
      # database.
      attr_accessor :current_service_objective_name

      # @return [String] The default secondary region for this database.
      attr_accessor :default_secondary_location

      # @return [String] Failover Group resource identifier that this database
      # belongs to.
      attr_accessor :failover_group_id

      # @return [DateTime] Specifies the point in time (ISO8601 format) of the
      # source database that will be restored to create the new database.
      attr_accessor :restore_point_in_time

      # @return [DateTime] Specifies the time that the database was deleted.
      attr_accessor :source_database_deletion_date

      # @return [String] The resource identifier of the recovery point
      # associated with create operation of this database.
      attr_accessor :recovery_services_recovery_point_id

      # @return [String] The resource identifier of the long term retention
      # backup associated with create operation of this database.
      attr_accessor :long_term_retention_backup_resource_id

      # @return [String] The resource identifier of the recoverable database
      # associated with create operation of this database.
      attr_accessor :recoverable_database_id

      # @return [String] The resource identifier of the restorable dropped
      # database associated with create operation of this database.
      attr_accessor :restorable_dropped_database_id

      # @return [CatalogCollationType] Collation of the metadata catalog.
      # Possible values include: 'DATABASE_DEFAULT',
      # 'SQL_Latin1_General_CP1_CI_AS'
      attr_accessor :catalog_collation

      # @return [Boolean] Whether or not this database is zone redundant, which
      # means the replicas of this database will be spread across multiple
      # availability zones.
      attr_accessor :zone_redundant


      #
      # Mapper for Database class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'Database',
          type: {
            name: 'Composite',
            class_name: 'Database',
            model_properties: {
              id: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'id',
                type: {
                  name: 'String'
                }
              },
              name: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'name',
                type: {
                  name: 'String'
                }
              },
              type: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'type',
                type: {
                  name: 'String'
                }
              },
              location: {
                client_side_validation: true,
                required: true,
                serialized_name: 'location',
                type: {
                  name: 'String'
                }
              },
              tags: {
                client_side_validation: true,
                required: false,
                serialized_name: 'tags',
                type: {
                  name: 'Dictionary',
                  value: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'StringElementType',
                      type: {
                        name: 'String'
                      }
                  }
                }
              },
              sku: {
                client_side_validation: true,
                required: false,
                serialized_name: 'sku',
                type: {
                  name: 'Composite',
                  class_name: 'Sku'
                }
              },
              kind: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'kind',
                type: {
                  name: 'String'
                }
              },
              create_mode: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.createMode',
                type: {
                  name: 'String'
                }
              },
              collation: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.collation',
                type: {
                  name: 'String'
                }
              },
              max_size_bytes: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.maxSizeBytes',
                type: {
                  name: 'Number'
                }
              },
              sample_name: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.sampleName',
                type: {
                  name: 'String'
                }
              },
              elastic_pool_id: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.elasticPoolId',
                type: {
                  name: 'String'
                }
              },
              source_database_id: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.sourceDatabaseId',
                type: {
                  name: 'String'
                }
              },
              status: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.status',
                type: {
                  name: 'String'
                }
              },
              database_id: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.databaseId',
                type: {
                  name: 'String'
                }
              },
              creation_date: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.creationDate',
                type: {
                  name: 'DateTime'
                }
              },
              current_service_objective_name: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.currentServiceObjectiveName',
                type: {
                  name: 'String'
                }
              },
              default_secondary_location: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.defaultSecondaryLocation',
                type: {
                  name: 'String'
                }
              },
              failover_group_id: {
                client_side_validation: true,
                required: false,
                read_only: true,
                serialized_name: 'properties.failoverGroupId',
                type: {
                  name: 'String'
                }
              },
              restore_point_in_time: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.restorePointInTime',
                type: {
                  name: 'DateTime'
                }
              },
              source_database_deletion_date: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.sourceDatabaseDeletionDate',
                type: {
                  name: 'DateTime'
                }
              },
              recovery_services_recovery_point_id: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.recoveryServicesRecoveryPointId',
                type: {
                  name: 'String'
                }
              },
              long_term_retention_backup_resource_id: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.longTermRetentionBackupResourceId',
                type: {
                  name: 'String'
                }
              },
              recoverable_database_id: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.recoverableDatabaseId',
                type: {
                  name: 'String'
                }
              },
              restorable_dropped_database_id: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.restorableDroppedDatabaseId',
                type: {
                  name: 'String'
                }
              },
              catalog_collation: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.catalogCollation',
                type: {
                  name: 'String'
                }
              },
              zone_redundant: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.zoneRedundant',
                type: {
                  name: 'Boolean'
                }
              }
            }
          }
        }
      end
    end
  end
end
