module TD.Data.StorageStatisticsFast
(StorageStatisticsFast(..)) where
import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
data StorageStatisticsFast
= StorageStatisticsFast
{ StorageStatisticsFast -> Maybe Int
files_size :: Maybe Int
, StorageStatisticsFast -> Maybe Int
file_count :: Maybe Int
, StorageStatisticsFast -> Maybe Int
database_size :: Maybe Int
, StorageStatisticsFast -> Maybe Int
language_pack_database_size :: Maybe Int
, StorageStatisticsFast -> Maybe Int
log_size :: Maybe Int
}
deriving (StorageStatisticsFast -> StorageStatisticsFast -> Bool
(StorageStatisticsFast -> StorageStatisticsFast -> Bool)
-> (StorageStatisticsFast -> StorageStatisticsFast -> Bool)
-> Eq StorageStatisticsFast
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: StorageStatisticsFast -> StorageStatisticsFast -> Bool
== :: StorageStatisticsFast -> StorageStatisticsFast -> Bool
$c/= :: StorageStatisticsFast -> StorageStatisticsFast -> Bool
/= :: StorageStatisticsFast -> StorageStatisticsFast -> Bool
Eq, Int -> StorageStatisticsFast -> ShowS
[StorageStatisticsFast] -> ShowS
StorageStatisticsFast -> String
(Int -> StorageStatisticsFast -> ShowS)
-> (StorageStatisticsFast -> String)
-> ([StorageStatisticsFast] -> ShowS)
-> Show StorageStatisticsFast
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> StorageStatisticsFast -> ShowS
showsPrec :: Int -> StorageStatisticsFast -> ShowS
$cshow :: StorageStatisticsFast -> String
show :: StorageStatisticsFast -> String
$cshowList :: [StorageStatisticsFast] -> ShowS
showList :: [StorageStatisticsFast] -> ShowS
Show)
instance I.ShortShow StorageStatisticsFast where
shortShow :: StorageStatisticsFast -> String
shortShow StorageStatisticsFast
{ files_size :: StorageStatisticsFast -> Maybe Int
files_size = Maybe Int
files_size_
, file_count :: StorageStatisticsFast -> Maybe Int
file_count = Maybe Int
file_count_
, database_size :: StorageStatisticsFast -> Maybe Int
database_size = Maybe Int
database_size_
, language_pack_database_size :: StorageStatisticsFast -> Maybe Int
language_pack_database_size = Maybe Int
language_pack_database_size_
, log_size :: StorageStatisticsFast -> Maybe Int
log_size = Maybe Int
log_size_
}
= String
"StorageStatisticsFast"
String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
[ String
"files_size" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
files_size_
, String
"file_count" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
file_count_
, String
"database_size" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
database_size_
, String
"language_pack_database_size" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
language_pack_database_size_
, String
"log_size" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
log_size_
]
instance AT.FromJSON StorageStatisticsFast where
parseJSON :: Value -> Parser StorageStatisticsFast
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
"storageStatisticsFast" -> Value -> Parser StorageStatisticsFast
parseStorageStatisticsFast Value
v
String
_ -> Parser StorageStatisticsFast
forall a. Monoid a => a
mempty
where
parseStorageStatisticsFast :: A.Value -> AT.Parser StorageStatisticsFast
parseStorageStatisticsFast :: Value -> Parser StorageStatisticsFast
parseStorageStatisticsFast = String
-> (Object -> Parser StorageStatisticsFast)
-> Value
-> Parser StorageStatisticsFast
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StorageStatisticsFast" ((Object -> Parser StorageStatisticsFast)
-> Value -> Parser StorageStatisticsFast)
-> (Object -> Parser StorageStatisticsFast)
-> Value
-> Parser StorageStatisticsFast
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
Maybe Int
files_size_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"files_size"
Maybe Int
file_count_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"file_count"
Maybe Int
database_size_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"database_size"
Maybe Int
language_pack_database_size_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"language_pack_database_size"
Maybe Int
log_size_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:? Key
"log_size"
StorageStatisticsFast -> Parser StorageStatisticsFast
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StorageStatisticsFast -> Parser StorageStatisticsFast)
-> StorageStatisticsFast -> Parser StorageStatisticsFast
forall a b. (a -> b) -> a -> b
$ StorageStatisticsFast
{ files_size :: Maybe Int
files_size = Maybe Int
files_size_
, file_count :: Maybe Int
file_count = Maybe Int
file_count_
, database_size :: Maybe Int
database_size = Maybe Int
database_size_
, language_pack_database_size :: Maybe Int
language_pack_database_size = Maybe Int
language_pack_database_size_
, log_size :: Maybe Int
log_size = Maybe Int
log_size_
}
parseJSON Value
_ = Parser StorageStatisticsFast
forall a. Monoid a => a
mempty