13 lines
460 B
Gleam
13 lines
460 B
Gleam
import gleam/dynamic/decode.{type Decoder}
|
|
import models/extraction_yield.{type ExtractionYield}
|
|
import models/ship_symbol.{type ShipSymbol}
|
|
|
|
pub type Extraction {
|
|
Extraction(ship_symbol: ShipSymbol, yield: ExtractionYield)
|
|
}
|
|
|
|
pub fn decoder() -> Decoder(Extraction) {
|
|
use ship_symbol <- decode.field("shipSymbol", ship_symbol.decoder())
|
|
use yield <- decode.field("yield", extraction_yield.decoder())
|
|
decode.success(Extraction(ship_symbol:, yield:))
|
|
}
|