module TD.Query.GetChatRevenueStatistics
  (GetChatRevenueStatistics(..)
  , defaultGetChatRevenueStatistics
  ) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I

-- | Returns detailed revenue statistics about a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true. Returns 'TD.Data.ChatRevenueStatistics.ChatRevenueStatistics'
data GetChatRevenueStatistics
  = GetChatRevenueStatistics
    { GetChatRevenueStatistics -> Maybe Int
chat_id :: Maybe Int  -- ^ Chat identifier
    , GetChatRevenueStatistics -> Maybe Bool
is_dark :: Maybe Bool -- ^ Pass true if a dark theme is used by the application
    }
  deriving (GetChatRevenueStatistics -> GetChatRevenueStatistics -> Bool
(GetChatRevenueStatistics -> GetChatRevenueStatistics -> Bool)
-> (GetChatRevenueStatistics -> GetChatRevenueStatistics -> Bool)
-> Eq GetChatRevenueStatistics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetChatRevenueStatistics -> GetChatRevenueStatistics -> Bool
== :: GetChatRevenueStatistics -> GetChatRevenueStatistics -> Bool
$c/= :: GetChatRevenueStatistics -> GetChatRevenueStatistics -> Bool
/= :: GetChatRevenueStatistics -> GetChatRevenueStatistics -> Bool
Eq, Int -> GetChatRevenueStatistics -> ShowS
[GetChatRevenueStatistics] -> ShowS
GetChatRevenueStatistics -> String
(Int -> GetChatRevenueStatistics -> ShowS)
-> (GetChatRevenueStatistics -> String)
-> ([GetChatRevenueStatistics] -> ShowS)
-> Show GetChatRevenueStatistics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetChatRevenueStatistics -> ShowS
showsPrec :: Int -> GetChatRevenueStatistics -> ShowS
$cshow :: GetChatRevenueStatistics -> String
show :: GetChatRevenueStatistics -> String
$cshowList :: [GetChatRevenueStatistics] -> ShowS
showList :: [GetChatRevenueStatistics] -> ShowS
Show)

instance I.ShortShow GetChatRevenueStatistics where
  shortShow :: GetChatRevenueStatistics -> String
shortShow
    GetChatRevenueStatistics
      { chat_id :: GetChatRevenueStatistics -> Maybe Int
chat_id = Maybe Int
chat_id_
      , is_dark :: GetChatRevenueStatistics -> Maybe Bool
is_dark = Maybe Bool
is_dark_
      }
        = String
"GetChatRevenueStatistics"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"chat_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
          , String
"is_dark" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_dark_
          ]

instance AT.ToJSON GetChatRevenueStatistics where
  toJSON :: GetChatRevenueStatistics -> Value
toJSON
    GetChatRevenueStatistics
      { chat_id :: GetChatRevenueStatistics -> Maybe Int
chat_id = Maybe Int
chat_id_
      , is_dark :: GetChatRevenueStatistics -> Maybe Bool
is_dark = Maybe Bool
is_dark_
      }
        = [Pair] -> Value
A.object
          [ Key
"@type"   Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"getChatRevenueStatistics"
          , Key
"chat_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
chat_id_
          , Key
"is_dark" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
is_dark_
          ]

defaultGetChatRevenueStatistics :: GetChatRevenueStatistics
defaultGetChatRevenueStatistics :: GetChatRevenueStatistics
defaultGetChatRevenueStatistics =
  GetChatRevenueStatistics
    { chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
    , is_dark :: Maybe Bool
is_dark = Maybe Bool
forall a. Maybe a
Nothing
    }