15 lines
449 B
Gleam
15 lines
449 B
Gleam
import gleam/dynamic/decode.{type Decoder}
|
|
import models/waypoint_symbol.{type WaypointSymbol}
|
|
|
|
pub type JumpGate {
|
|
JumpGate(symbol: WaypointSymbol, connections: List(WaypointSymbol))
|
|
}
|
|
|
|
pub fn decoder() -> Decoder(JumpGate) {
|
|
use symbol <- decode.field("symbol", waypoint_symbol.decoder())
|
|
use connections <- decode.field(
|
|
"connections",
|
|
decode.list(waypoint_symbol.decoder()),
|
|
)
|
|
decode.success(JumpGate(symbol:, connections:))
|
|
}
|