{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell   #-}

module CoinbasePro.WebSocketFeed.Channel.Full.Change
    ( Change (..)
    ) where

import           Data.Aeson.Casing (snakeCase)
import           Data.Aeson.TH     (defaultOptions, deriveJSON,
                                    fieldLabelModifier)
import           Data.Time.Clock   (UTCTime)

import           CoinbasePro.Types (Funds, OrderId, Price, ProductId, ProfileId,
                                    Sequence, Side, Size, UserId)


data Change = Change
    { Change -> UTCTime
time      :: UTCTime
    , Change -> Sequence
sequence  :: Sequence
    , Change -> OrderId
orderId   :: OrderId
    , Change -> ProductId
productId :: ProductId
    , Change -> Maybe Size
newSize   :: Maybe Size
    , Change -> Maybe Size
oldSize   :: Maybe Size
    , Change -> Maybe Funds
newFunds  :: Maybe Funds
    , Change -> Maybe Funds
oldFunds  :: Maybe Funds
    , Change -> Maybe Price
price     :: Maybe Price
    , Change -> Side
side      :: Side
    , Change -> Maybe UserId
userId    :: Maybe UserId
    , Change -> Maybe UserId
profileId :: Maybe ProfileId
    } deriving (Change -> Change -> Bool
(Change -> Change -> Bool)
-> (Change -> Change -> Bool) -> Eq Change
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Change -> Change -> Bool
$c/= :: Change -> Change -> Bool
== :: Change -> Change -> Bool
$c== :: Change -> Change -> Bool
Eq, Eq Change
Eq Change
-> (Change -> Change -> Ordering)
-> (Change -> Change -> Bool)
-> (Change -> Change -> Bool)
-> (Change -> Change -> Bool)
-> (Change -> Change -> Bool)
-> (Change -> Change -> Change)
-> (Change -> Change -> Change)
-> Ord Change
Change -> Change -> Bool
Change -> Change -> Ordering
Change -> Change -> Change
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Change -> Change -> Change
$cmin :: Change -> Change -> Change
max :: Change -> Change -> Change
$cmax :: Change -> Change -> Change
>= :: Change -> Change -> Bool
$c>= :: Change -> Change -> Bool
> :: Change -> Change -> Bool
$c> :: Change -> Change -> Bool
<= :: Change -> Change -> Bool
$c<= :: Change -> Change -> Bool
< :: Change -> Change -> Bool
$c< :: Change -> Change -> Bool
compare :: Change -> Change -> Ordering
$ccompare :: Change -> Change -> Ordering
$cp1Ord :: Eq Change
Ord, Sequence -> Change -> ShowS
[Change] -> ShowS
Change -> String
(Sequence -> Change -> ShowS)
-> (Change -> String) -> ([Change] -> ShowS) -> Show Change
forall a.
(Sequence -> a -> ShowS)
-> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Change] -> ShowS
$cshowList :: [Change] -> ShowS
show :: Change -> String
$cshow :: Change -> String
showsPrec :: Sequence -> Change -> ShowS
$cshowsPrec :: Sequence -> Change -> ShowS
Show)


deriveJSON defaultOptions {fieldLabelModifier = snakeCase} ''Change