# NOTE: This file is auto generated by OpenAPI Generator 7.12.0 (https://openapi-generator.tech).
# Do not edit this file manually.

defmodule Ory.Model.Identity do
  @moduledoc """
  An [identity](https://www.ory.sh/docs/kratos/concepts/identity-user-model) represents a (human) user in Ory.
  """

  @derive Jason.Encoder
  defstruct [
    :created_at,
    :credentials,
    :external_id,
    :id,
    :metadata_admin,
    :metadata_public,
    :organization_id,
    :recovery_addresses,
    :schema_id,
    :schema_url,
    :state,
    :state_changed_at,
    :traits,
    :updated_at,
    :verifiable_addresses
  ]

  @type t :: %__MODULE__{
    :created_at => DateTime.t | nil,
    :credentials => %{optional(String.t) => Ory.Model.IdentityCredentials.t} | nil,
    :external_id => String.t | nil,
    :id => String.t,
    :metadata_admin => map() | nil,
    :metadata_public => map() | nil,
    :organization_id => String.t | nil,
    :recovery_addresses => [Ory.Model.RecoveryIdentityAddress.t] | nil,
    :schema_id => String.t,
    :schema_url => String.t,
    :state => String.t | nil,
    :state_changed_at => DateTime.t | nil,
    :traits => any() | nil,
    :updated_at => DateTime.t | nil,
    :verifiable_addresses => [Ory.Model.VerifiableIdentityAddress.t] | nil
  }

  alias Ory.Deserializer

  def decode(value) do
    value
     |> Deserializer.deserialize(:created_at, :datetime, nil)
     |> Deserializer.deserialize(:credentials, :map, Ory.Model.IdentityCredentials)
     |> Deserializer.deserialize(:recovery_addresses, :list, Ory.Model.RecoveryIdentityAddress)
     |> Deserializer.deserialize(:state_changed_at, :datetime, nil)
     |> Deserializer.deserialize(:updated_at, :datetime, nil)
     |> Deserializer.deserialize(:verifiable_addresses, :list, Ory.Model.VerifiableIdentityAddress)
  end
end

