# defmodule Asdf do # @fiat_crypto_symbols Zoi.enum(["USD", "USDT", "BRL", "EUR", "JPY", "BTC"]) # # @quote Zoi.map( # @fiat_crypto_symbols, # Zoi.object( # %{ # price: # Zoi.optional(Zoi.decimal(coerce: true) |> Zoi.transform({__MODULE__, :hi, []})), # last_updated: Zoi.datetime(coerce: true) # }, # coerce: true # ) # ) # @currency_data Zoi.object(%{quote: @quote}, coerce: true) # # @schema Zoi.object( # # %{ # # data: Zoi.map(@fiat_crypto_symbols, @currency_data) # # }, # # coerce: true # # ) # # @schema Zoi.object(%{data: Zoi.array(@currency_data)}, coerce: true) # # def hi(_decimal, _ctx) do # 2 # end # # def parse() do # params = %{ # "data" => [ # %{ # "amount" => 1, # "id" => 2790, # "last_updated" => "2025-08-28T14:34:58.000Z", # "name" => "Euro", # "quote" => %{ # "BRL" => %{ # "last_updated" => "2025-08-28T14:35:58.000Z", # "price" => 6.320665443882321 # }, # "BTC" => %{ # "last_updated" => "2025-08-28T14:35:00.000Z", # "price" => 1.036447497212581e-5 # }, # "JPY" => %{ # "last_updated" => "2025-08-28T14:35:58.000Z", # "price" => 171.68195147035894 # }, # "USD" => %{ # "last_updated" => "2025-08-28T14:34:58.000Z", # "price" => 1.16826524294076 # }, # "USDT" => %{ # "last_updated" => "2025-08-28T14:35:00.000Z", # "price" => 1.168228877468982 # } # }, # "symbol" => "EUR" # } # ], # "status" => %{ # "credit_count" => 5, # "elapsed" => 67, # "error_code" => 0, # "error_message" => nil, # "notice" => nil, # "timestamp" => "2025-08-28T14:37:13.531Z" # } # } # # Zoi.parse(@schema, params) # end # end