# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainInternalResourceMetadata do
  @moduledoc """
  Metadata for individual internal resources in an instance. e.g. spanner instance can have multiple databases with unique configuration settings. Similarly bigtable can have multiple clusters within same bigtable instance.

  ## Attributes

  *   `backupConfiguration` (*type:* `GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainBackupConfiguration.t`, *default:* `nil`) - Backup configuration for this database
  *   `backupRun` (*type:* `GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainBackupRun.t`, *default:* `nil`) - Information about the last backup attempt for this database
  *   `isDeletionProtectionEnabled` (*type:* `boolean()`, *default:* `nil`) - Whether deletion protection is enabled for this internal resource.
  *   `product` (*type:* `GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterProtoCommonProduct.t`, *default:* `nil`) - 
  *   `resourceId` (*type:* `GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainDatabaseResourceId.t`, *default:* `nil`) - 
  *   `resourceName` (*type:* `String.t`, *default:* `nil`) - Required. internal resource name for spanner this will be database name e.g."spanner.googleapis.com/projects/123/abc/instances/inst1/databases/db1"
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :backupConfiguration =>
            GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainBackupConfiguration.t()
            | nil,
          :backupRun =>
            GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainBackupRun.t() | nil,
          :isDeletionProtectionEnabled => boolean() | nil,
          :product =>
            GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterProtoCommonProduct.t() | nil,
          :resourceId =>
            GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainDatabaseResourceId.t()
            | nil,
          :resourceName => String.t() | nil
        }

  field(:backupConfiguration,
    as: GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainBackupConfiguration
  )

  field(:backupRun, as: GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainBackupRun)
  field(:isDeletionProtectionEnabled)
  field(:product, as: GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterProtoCommonProduct)

  field(:resourceId,
    as: GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainDatabaseResourceId
  )

  field(:resourceName)
end

defimpl Poison.Decoder,
  for: GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainInternalResourceMetadata do
  def decode(value, options) do
    GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainInternalResourceMetadata.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.AlloyDB.V1.Model.StorageDatabasecenterPartnerapiV1mainInternalResourceMetadata do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
