# 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.UserLanguage do
  @moduledoc """
  JSON template for a language entry.

  ## Attributes

  *   `customLanguage` (*type:* `String.t`, *default:* `nil`) - Other language. User can provide their own language name if there is no corresponding ISO 639 language code. If this is set, `languageCode` can't be set.
  *   `languageCode` (*type:* `String.t`, *default:* `nil`) - ISO 639 string representation of a language. See [Language Codes](/admin-sdk/directory/v1/languages) for the list of supported codes. Valid language codes outside the supported set will be accepted by the API but may lead to unexpected behavior. Illegal values cause `SchemaException`. If this is set, `customLanguage` can't be set.
  *   `preference` (*type:* `String.t`, *default:* `nil`) - Optional. If present, controls whether the specified `languageCode` is the user's preferred language. If `customLanguage` is set, this can't be set. Allowed values are `preferred` and `not_preferred`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :customLanguage => String.t() | nil,
          :languageCode => String.t() | nil,
          :preference => String.t() | nil
        }

  field(:customLanguage)
  field(:languageCode)
  field(:preference)
end

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

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