module TD.Query.SetChatPaidMessageStarCount
  (SetChatPaidMessageStarCount(..)
  , defaultSetChatPaidMessageStarCount
  ) where

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

-- | Changes the amount of Telegram Stars that must be paid to send a message to a supergroup chat; requires can_restrict_members administrator right and supergroupFullInfo.can_enable_paid_messages. Returns 'TD.Data.Ok.Ok'
data SetChatPaidMessageStarCount
  = SetChatPaidMessageStarCount
    { SetChatPaidMessageStarCount -> Maybe Int
chat_id                 :: Maybe Int -- ^ Identifier of the supergroup chat
    ,  :: Maybe Int -- ^ The new number of Telegram Stars that must be paid for each message that is sent to the supergroup chat unless the sender is an administrator of the chat; 0-getOption("paid_message_star_count_max"). The supergroup will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending
    }
  deriving (SetChatPaidMessageStarCount -> SetChatPaidMessageStarCount -> Bool
(SetChatPaidMessageStarCount
 -> SetChatPaidMessageStarCount -> Bool)
-> (SetChatPaidMessageStarCount
    -> SetChatPaidMessageStarCount -> Bool)
-> Eq SetChatPaidMessageStarCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetChatPaidMessageStarCount -> SetChatPaidMessageStarCount -> Bool
== :: SetChatPaidMessageStarCount -> SetChatPaidMessageStarCount -> Bool
$c/= :: SetChatPaidMessageStarCount -> SetChatPaidMessageStarCount -> Bool
/= :: SetChatPaidMessageStarCount -> SetChatPaidMessageStarCount -> Bool
Eq, Int -> SetChatPaidMessageStarCount -> ShowS
[SetChatPaidMessageStarCount] -> ShowS
SetChatPaidMessageStarCount -> String
(Int -> SetChatPaidMessageStarCount -> ShowS)
-> (SetChatPaidMessageStarCount -> String)
-> ([SetChatPaidMessageStarCount] -> ShowS)
-> Show SetChatPaidMessageStarCount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetChatPaidMessageStarCount -> ShowS
showsPrec :: Int -> SetChatPaidMessageStarCount -> ShowS
$cshow :: SetChatPaidMessageStarCount -> String
show :: SetChatPaidMessageStarCount -> String
$cshowList :: [SetChatPaidMessageStarCount] -> ShowS
showList :: [SetChatPaidMessageStarCount] -> ShowS
Show)

instance I.ShortShow SetChatPaidMessageStarCount where
  shortShow :: SetChatPaidMessageStarCount -> String
shortShow
    SetChatPaidMessageStarCount
      { chat_id :: SetChatPaidMessageStarCount -> Maybe Int
chat_id                 = Maybe Int
chat_id_
      , paid_message_star_count :: SetChatPaidMessageStarCount -> Maybe Int
paid_message_star_count = Maybe Int
paid_message_star_count_
      }
        = String
"SetChatPaidMessageStarCount"
          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
"paid_message_star_count" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
paid_message_star_count_
          ]

instance AT.ToJSON SetChatPaidMessageStarCount where
  toJSON :: SetChatPaidMessageStarCount -> Value
toJSON
    SetChatPaidMessageStarCount
      { chat_id :: SetChatPaidMessageStarCount -> Maybe Int
chat_id                 = Maybe Int
chat_id_
      , paid_message_star_count :: SetChatPaidMessageStarCount -> Maybe Int
paid_message_star_count = Maybe Int
paid_message_star_count_
      }
        = [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
"setChatPaidMessageStarCount"
          , 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
"paid_message_star_count" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
paid_message_star_count_
          ]

defaultSetChatPaidMessageStarCount :: SetChatPaidMessageStarCount
defaultSetChatPaidMessageStarCount :: SetChatPaidMessageStarCount
defaultSetChatPaidMessageStarCount =
  SetChatPaidMessageStarCount
    { chat_id :: Maybe Int
chat_id                 = Maybe Int
forall a. Maybe a
Nothing
    , paid_message_star_count :: Maybe Int
paid_message_star_count = Maybe Int
forall a. Maybe a
Nothing
    }