module TD.Query.GetChatRevenueTransactions
  (GetChatRevenueTransactions(..)
  , defaultGetChatRevenueTransactions
  ) where

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

-- | Returns the list of revenue transactions for a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true. Returns 'TD.Data.ChatRevenueTransactions.ChatRevenueTransactions'
data GetChatRevenueTransactions
  = GetChatRevenueTransactions
    { GetChatRevenueTransactions -> Maybe Int
chat_id :: Maybe Int -- ^ Chat identifier
    , GetChatRevenueTransactions -> Maybe Int
offset  :: Maybe Int -- ^ Number of transactions to skip
    , GetChatRevenueTransactions -> Maybe Int
limit   :: Maybe Int -- ^ The maximum number of transactions to be returned; up to 200
    }
  deriving (GetChatRevenueTransactions -> GetChatRevenueTransactions -> Bool
(GetChatRevenueTransactions -> GetChatRevenueTransactions -> Bool)
-> (GetChatRevenueTransactions
    -> GetChatRevenueTransactions -> Bool)
-> Eq GetChatRevenueTransactions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetChatRevenueTransactions -> GetChatRevenueTransactions -> Bool
== :: GetChatRevenueTransactions -> GetChatRevenueTransactions -> Bool
$c/= :: GetChatRevenueTransactions -> GetChatRevenueTransactions -> Bool
/= :: GetChatRevenueTransactions -> GetChatRevenueTransactions -> Bool
Eq, Int -> GetChatRevenueTransactions -> ShowS
[GetChatRevenueTransactions] -> ShowS
GetChatRevenueTransactions -> String
(Int -> GetChatRevenueTransactions -> ShowS)
-> (GetChatRevenueTransactions -> String)
-> ([GetChatRevenueTransactions] -> ShowS)
-> Show GetChatRevenueTransactions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetChatRevenueTransactions -> ShowS
showsPrec :: Int -> GetChatRevenueTransactions -> ShowS
$cshow :: GetChatRevenueTransactions -> String
show :: GetChatRevenueTransactions -> String
$cshowList :: [GetChatRevenueTransactions] -> ShowS
showList :: [GetChatRevenueTransactions] -> ShowS
Show)

instance I.ShortShow GetChatRevenueTransactions where
  shortShow :: GetChatRevenueTransactions -> String
shortShow
    GetChatRevenueTransactions
      { chat_id :: GetChatRevenueTransactions -> Maybe Int
chat_id = Maybe Int
chat_id_
      , offset :: GetChatRevenueTransactions -> Maybe Int
offset  = Maybe Int
offset_
      , limit :: GetChatRevenueTransactions -> Maybe Int
limit   = Maybe Int
limit_
      }
        = String
"GetChatRevenueTransactions"
          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
"offset"  String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
offset_
          , String
"limit"   String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
limit_
          ]

instance AT.ToJSON GetChatRevenueTransactions where
  toJSON :: GetChatRevenueTransactions -> Value
toJSON
    GetChatRevenueTransactions
      { chat_id :: GetChatRevenueTransactions -> Maybe Int
chat_id = Maybe Int
chat_id_
      , offset :: GetChatRevenueTransactions -> Maybe Int
offset  = Maybe Int
offset_
      , limit :: GetChatRevenueTransactions -> Maybe Int
limit   = Maybe Int
limit_
      }
        = [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
"getChatRevenueTransactions"
          , 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
"offset"  Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
offset_
          , Key
"limit"   Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
limit_
          ]

defaultGetChatRevenueTransactions :: GetChatRevenueTransactions
defaultGetChatRevenueTransactions :: GetChatRevenueTransactions
defaultGetChatRevenueTransactions =
  GetChatRevenueTransactions
    { chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
    , offset :: Maybe Int
offset  = Maybe Int
forall a. Maybe a
Nothing
    , limit :: Maybe Int
limit   = Maybe Int
forall a. Maybe a
Nothing
    }