defmodule StellarBase.XDR.ConfigSettingID do @moduledoc """ Automatically generated by xdrgen DO NOT EDIT or your changes may be overwritten Target implementation: elixir_xdr at https://hex.pm/packages/elixir_xdr Representation of Stellar `ConfigSettingID` type. """ @behaviour XDR.Declaration @declarations [ CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES: 0, CONFIG_SETTING_CONTRACT_COMPUTE_V0: 1, CONFIG_SETTING_CONTRACT_LEDGER_COST_V0: 2, CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0: 3, CONFIG_SETTING_CONTRACT_META_DATA_V0: 4, CONFIG_SETTING_CONTRACT_BANDWIDTH_V0: 5, CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS: 6, CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES: 7, CONFIG_SETTING_CONTRACT_DATA_KEY_SIZE_BYTES: 8, CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES: 9, CONFIG_SETTING_STATE_EXPIRATION: 10, CONFIG_SETTING_CONTRACT_EXECUTION_LANES: 11, CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW: 12 ] @enum_spec %XDR.Enum{declarations: @declarations, identifier: nil} @type t :: %__MODULE__{identifier: atom()} defstruct [:identifier] @spec new(type :: atom()) :: t() def new(type \\ :CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES), do: %__MODULE__{identifier: type} @impl true def encode_xdr(%__MODULE__{identifier: type}) do @declarations |> XDR.Enum.new(type) |> XDR.Enum.encode_xdr() end @impl true def encode_xdr!(%__MODULE__{identifier: type}) do @declarations |> XDR.Enum.new(type) |> XDR.Enum.encode_xdr!() end @impl true def decode_xdr(bytes, spec \\ @enum_spec) def decode_xdr(bytes, spec) do case XDR.Enum.decode_xdr(bytes, spec) do {:ok, {%XDR.Enum{identifier: type}, rest}} -> {:ok, {new(type), rest}} error -> error end end @impl true def decode_xdr!(bytes, spec \\ @enum_spec) def decode_xdr!(bytes, spec) do {%XDR.Enum{identifier: type}, rest} = XDR.Enum.decode_xdr!(bytes, spec) {new(type), rest} end end