# 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.Admin.Directory_v1.Model.Schema do
  @moduledoc """
  The type of API resource. For Schema resources, this is always `admin#directory#schema`.

  ## Attributes

  *   `displayName` (*type:* `String.t`, *default:* `nil`) - Display name for the schema.
  *   `etag` (*type:* `String.t`, *default:* `nil`) - The ETag of the resource.
  *   `fields` (*type:* `list(GoogleApi.Admin.Directory_v1.Model.SchemaFieldSpec.t)`, *default:* `nil`) - A list of fields in the schema.
  *   `kind` (*type:* `String.t`, *default:* `admin#directory#schema`) - Kind of resource this is.
  *   `schemaId` (*type:* `String.t`, *default:* `nil`) - The unique identifier of the schema (Read-only)
  *   `schemaName` (*type:* `String.t`, *default:* `nil`) - The schema's name. Each `schema_name` must be unique within a customer. Reusing a name results in a `409: Entity already exists` error.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :displayName => String.t() | nil,
          :etag => String.t() | nil,
          :fields => list(GoogleApi.Admin.Directory_v1.Model.SchemaFieldSpec.t()) | nil,
          :kind => String.t() | nil,
          :schemaId => String.t() | nil,
          :schemaName => String.t() | nil
        }

  field(:displayName)
  field(:etag)
  field(:fields, as: GoogleApi.Admin.Directory_v1.Model.SchemaFieldSpec, type: :list)
  field(:kind)
  field(:schemaId)
  field(:schemaName)
end

defimpl Poison.Decoder, for: GoogleApi.Admin.Directory_v1.Model.Schema do
  def decode(value, options) do
    GoogleApi.Admin.Directory_v1.Model.Schema.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Admin.Directory_v1.Model.Schema do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
