[haskell] Update models for september 14th changelog
This commit is contained in:
parent
0ecb8e87c0
commit
414aebd697
3 changed files with 13 additions and 4 deletions
|
@ -13,9 +13,9 @@ import GHC.Generics
|
|||
import qualified Data.Text as T
|
||||
|
||||
data Route = Route { arrival :: UTCTime
|
||||
, departure :: RouteEndpoint
|
||||
, departureTime :: UTCTime
|
||||
, destination :: RouteEndpoint
|
||||
, origin :: RouteEndpoint
|
||||
} deriving (FromJSON, Generic, Show, ToJSON)
|
||||
|
||||
data RouteEndpoint = RouteEndpoint { routeEndpointType :: T.Text
|
||||
|
|
|
@ -15,6 +15,7 @@ import SpaceTraders.Model.Fuel
|
|||
import SpaceTraders.Model.Nav
|
||||
|
||||
data Ship = Ship { cargo :: Cargo
|
||||
, cooldown :: Cooldown
|
||||
--, crew :: Crew
|
||||
--, engine :: Engine
|
||||
--, frame :: Frame
|
||||
|
@ -26,3 +27,8 @@ data Ship = Ship { cargo :: Cargo
|
|||
--, registration :: Registration
|
||||
, symbol :: T.Text
|
||||
} deriving (FromJSON, Generic, Show, ToJSON)
|
||||
|
||||
data Cooldown = Cooldown { shipSymbol :: T.Text
|
||||
, totalSeconds :: Int
|
||||
, remainingSeconds :: Int
|
||||
} deriving (FromJSON, Generic, Show, ToJSON)
|
||||
|
|
|
@ -10,19 +10,22 @@ import Data.Aeson
|
|||
import qualified Data.Text as T
|
||||
import GHC.Generics
|
||||
|
||||
data Waypoint = Waypoint { symbol :: T.Text
|
||||
data Waypoint = Waypoint { orbits :: Maybe T.Text
|
||||
, symbol :: T.Text
|
||||
, waypointType :: T.Text
|
||||
, x :: Int
|
||||
, y :: Int
|
||||
} deriving (Generic, Show)
|
||||
instance FromJSON Waypoint where
|
||||
parseJSON = withObject "Waypoint" $ \o ->
|
||||
Waypoint <$> o .: "symbol"
|
||||
Waypoint <$> o .:? "orbits"
|
||||
<*> o .: "symbol"
|
||||
<*> o .: "type"
|
||||
<*> o .: "x"
|
||||
<*> o .: "y"
|
||||
instance ToJSON Waypoint where
|
||||
toJSON (Waypoint o s t xx yy) = object [ "symbol" .= s
|
||||
toJSON (Waypoint o s t xx yy) = object [ "orbits" .= o
|
||||
, "symbol" .= s
|
||||
, "type" .= t
|
||||
, "x" .= xx
|
||||
, "y" .= yy ]
|
||||
|
|
Loading…
Add table
Reference in a new issue