module TD.Query.SetPaidMessageReactionType
  (SetPaidMessageReactionType(..)
  , defaultSetPaidMessageReactionType
  ) 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.PaidReactionType as PaidReactionType

-- | Changes type of paid message reaction of the current user on a message. The message must have paid reaction added by the current user. Returns 'TD.Data.Ok.Ok'
data SetPaidMessageReactionType
  = SetPaidMessageReactionType
    { SetPaidMessageReactionType -> Maybe Int
chat_id    :: Maybe Int                               -- ^ Identifier of the chat to which the message belongs
    , SetPaidMessageReactionType -> Maybe Int
message_id :: Maybe Int                               -- ^ Identifier of the message
    , SetPaidMessageReactionType -> Maybe PaidReactionType
_type      :: Maybe PaidReactionType.PaidReactionType -- ^ New type of the paid reaction
    }
  deriving (SetPaidMessageReactionType -> SetPaidMessageReactionType -> Bool
(SetPaidMessageReactionType -> SetPaidMessageReactionType -> Bool)
-> (SetPaidMessageReactionType
    -> SetPaidMessageReactionType -> Bool)
-> Eq SetPaidMessageReactionType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetPaidMessageReactionType -> SetPaidMessageReactionType -> Bool
== :: SetPaidMessageReactionType -> SetPaidMessageReactionType -> Bool
$c/= :: SetPaidMessageReactionType -> SetPaidMessageReactionType -> Bool
/= :: SetPaidMessageReactionType -> SetPaidMessageReactionType -> Bool
Eq, Int -> SetPaidMessageReactionType -> ShowS
[SetPaidMessageReactionType] -> ShowS
SetPaidMessageReactionType -> String
(Int -> SetPaidMessageReactionType -> ShowS)
-> (SetPaidMessageReactionType -> String)
-> ([SetPaidMessageReactionType] -> ShowS)
-> Show SetPaidMessageReactionType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetPaidMessageReactionType -> ShowS
showsPrec :: Int -> SetPaidMessageReactionType -> ShowS
$cshow :: SetPaidMessageReactionType -> String
show :: SetPaidMessageReactionType -> String
$cshowList :: [SetPaidMessageReactionType] -> ShowS
showList :: [SetPaidMessageReactionType] -> ShowS
Show)

instance I.ShortShow SetPaidMessageReactionType where
  shortShow :: SetPaidMessageReactionType -> String
shortShow
    SetPaidMessageReactionType
      { chat_id :: SetPaidMessageReactionType -> Maybe Int
chat_id    = Maybe Int
chat_id_
      , message_id :: SetPaidMessageReactionType -> Maybe Int
message_id = Maybe Int
message_id_
      , _type :: SetPaidMessageReactionType -> Maybe PaidReactionType
_type      = Maybe PaidReactionType
_type_
      }
        = String
"SetPaidMessageReactionType"
          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
"message_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_id_
          , String
"_type"      String -> Maybe PaidReactionType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PaidReactionType
_type_
          ]

instance AT.ToJSON SetPaidMessageReactionType where
  toJSON :: SetPaidMessageReactionType -> Value
toJSON
    SetPaidMessageReactionType
      { chat_id :: SetPaidMessageReactionType -> Maybe Int
chat_id    = Maybe Int
chat_id_
      , message_id :: SetPaidMessageReactionType -> Maybe Int
message_id = Maybe Int
message_id_
      , _type :: SetPaidMessageReactionType -> Maybe PaidReactionType
_type      = Maybe PaidReactionType
_type_
      }
        = [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
"setPaidMessageReactionType"
          , 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
"message_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
message_id_
          , Key
"type"       Key -> Maybe PaidReactionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe PaidReactionType
_type_
          ]

defaultSetPaidMessageReactionType :: SetPaidMessageReactionType
defaultSetPaidMessageReactionType :: SetPaidMessageReactionType
defaultSetPaidMessageReactionType =
  SetPaidMessageReactionType
    { chat_id :: Maybe Int
chat_id    = Maybe Int
forall a. Maybe a
Nothing
    , message_id :: Maybe Int
message_id = Maybe Int
forall a. Maybe a
Nothing
    , _type :: Maybe PaidReactionType
_type      = Maybe PaidReactionType
forall a. Maybe a
Nothing
    }