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

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)