17 lines
551 B
Gleam
17 lines
551 B
Gleam
import gleam/dynamic/decode.{type Decoder}
|
|
import models/waypoint_modifier_symbol.{type WaypointModifierSymbol}
|
|
|
|
pub type WaypointModifier {
|
|
WaypointModifier(
|
|
symbol: WaypointModifierSymbol,
|
|
name: String,
|
|
description: String,
|
|
)
|
|
}
|
|
|
|
pub fn decoder() -> Decoder(WaypointModifier) {
|
|
use symbol <- decode.field("symbol", waypoint_modifier_symbol.decoder())
|
|
use name <- decode.field("name", decode.string)
|
|
use description <- decode.field("description", decode.string)
|
|
decode.success(WaypointModifier(symbol:, name:, description:))
|
|
}
|