module TD.Data.StarRevenueStatistics
(StarRevenueStatistics(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified TD.Data.StatisticalGraph as StatisticalGraph
import qualified TD.Data.StarRevenueStatus as StarRevenueStatus
data StarRevenueStatistics
= StarRevenueStatistics
{ StarRevenueStatistics -> Maybe StatisticalGraph
revenue_by_day_graph :: Maybe StatisticalGraph.StatisticalGraph
, StarRevenueStatistics -> Maybe StarRevenueStatus
status :: Maybe StarRevenueStatus.StarRevenueStatus
, StarRevenueStatistics -> Maybe Double
usd_rate :: Maybe Double
}
deriving (StarRevenueStatistics -> StarRevenueStatistics -> Bool
(StarRevenueStatistics -> StarRevenueStatistics -> Bool)
-> (StarRevenueStatistics -> StarRevenueStatistics -> Bool)
-> Eq StarRevenueStatistics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: StarRevenueStatistics -> StarRevenueStatistics -> Bool
== :: StarRevenueStatistics -> StarRevenueStatistics -> Bool
$c/= :: StarRevenueStatistics -> StarRevenueStatistics -> Bool
/= :: StarRevenueStatistics -> StarRevenueStatistics -> Bool
Eq, Int -> StarRevenueStatistics -> ShowS
[StarRevenueStatistics] -> ShowS
StarRevenueStatistics -> String
(Int -> StarRevenueStatistics -> ShowS)
-> (StarRevenueStatistics -> String)
-> ([StarRevenueStatistics] -> ShowS)
-> Show StarRevenueStatistics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> StarRevenueStatistics -> ShowS
showsPrec :: Int -> StarRevenueStatistics -> ShowS
$cshow :: StarRevenueStatistics -> String
show :: StarRevenueStatistics -> String
$cshowList :: [StarRevenueStatistics] -> ShowS
showList :: [StarRevenueStatistics] -> ShowS
Show)
instance I.ShortShow StarRevenueStatistics where
shortShow :: StarRevenueStatistics -> String
shortShow StarRevenueStatistics
{ revenue_by_day_graph :: StarRevenueStatistics -> Maybe StatisticalGraph
revenue_by_day_graph = Maybe StatisticalGraph
revenue_by_day_graph_
, status :: StarRevenueStatistics -> Maybe StarRevenueStatus
status = Maybe StarRevenueStatus
status_
, usd_rate :: StarRevenueStatistics -> Maybe Double
usd_rate = Maybe Double
usd_rate_
}
= String
"StarRevenueStatistics"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"revenue_by_day_graph" String -> Maybe StatisticalGraph -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe StatisticalGraph
revenue_by_day_graph_
, String
"status" String -> Maybe StarRevenueStatus -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe StarRevenueStatus
status_
, String
"usd_rate" String -> Maybe Double -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Double
usd_rate_
]
instance AT.FromJSON StarRevenueStatistics where
parseJSON :: Value -> Parser StarRevenueStatistics
parseJSON v :: Value
v@(AT.Object Object
obj) = do
String
t <- Object
obj Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"@type" :: AT.Parser String
case String
t of
String
"starRevenueStatistics" -> Value -> Parser StarRevenueStatistics
parseStarRevenueStatistics Value
v
String
_ -> Parser StarRevenueStatistics
forall a. Monoid a => a
mempty
where
parseStarRevenueStatistics :: A.Value -> AT.Parser StarRevenueStatistics
parseStarRevenueStatistics :: Value -> Parser StarRevenueStatistics
parseStarRevenueStatistics = String
-> (Object -> Parser StarRevenueStatistics)
-> Value
-> Parser StarRevenueStatistics
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarRevenueStatistics" ((Object -> Parser StarRevenueStatistics)
-> Value -> Parser StarRevenueStatistics)
-> (Object -> Parser StarRevenueStatistics)
-> Value
-> Parser StarRevenueStatistics
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe StatisticalGraph
revenue_by_day_graph_ <- Object
o Object -> Key -> Parser (Maybe StatisticalGraph)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"revenue_by_day_graph"
Maybe StarRevenueStatus
status_ <- Object
o Object -> Key -> Parser (Maybe StarRevenueStatus)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"status"
Maybe Double
usd_rate_ <- Object
o Object -> Key -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"usd_rate"
StarRevenueStatistics -> Parser StarRevenueStatistics
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarRevenueStatistics -> Parser StarRevenueStatistics)
-> StarRevenueStatistics -> Parser StarRevenueStatistics
forall a b. (a -> b) -> a -> b
$ StarRevenueStatistics
{ revenue_by_day_graph :: Maybe StatisticalGraph
revenue_by_day_graph = Maybe StatisticalGraph
revenue_by_day_graph_
, status :: Maybe StarRevenueStatus
status = Maybe StarRevenueStatus
status_
, usd_rate :: Maybe Double
usd_rate = Maybe Double
usd_rate_
}
parseJSON Value
_ = Parser StarRevenueStatistics
forall a. Monoid a => a
mempty