summaryrefslogtreecommitdiff
path: root/haskell/src/SpaceTraders/Model/Fuel.hs
blob: 99c47098ffe197450ee1f7ac56be2af684deaaed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric  #-}

module SpaceTraders.Model.Fuel
  ( Consumed(..)
  , Fuel(..)
  ) where

import           Data.Aeson
import           Data.Time
import           GHC.Generics

data Consumed = Consumed { amount    :: Int
                         , timestamp :: UTCTime
                         } deriving (FromJSON, Generic, Show, ToJSON)

data Fuel = Fuel { capacity :: Int
                 , consumed :: Consumed
                 , current  :: Int
                 } deriving (FromJSON, Generic, Show, ToJSON)