13 lines
510 B
Gleam
13 lines
510 B
Gleam
import gleam/dynamic/decode.{type Decoder}
|
|
import models/waypoint_trait_symbol.{type WaypointTraitSymbol}
|
|
|
|
pub type WaypointTrait {
|
|
WaypointTrait(symbol: WaypointTraitSymbol, name: String, description: String)
|
|
}
|
|
|
|
pub fn decoder() -> Decoder(WaypointTrait) {
|
|
use symbol <- decode.field("symbol", waypoint_trait_symbol.decoder())
|
|
use name <- decode.field("name", decode.string)
|
|
use description <- decode.field("description", decode.string)
|
|
decode.success(WaypointTrait(symbol:, name:, description:))
|
|
}
|