module TD.Query.UnpinAllDirectMessagesChatTopicMessages
  (UnpinAllDirectMessagesChatTopicMessages(..)
  , defaultUnpinAllDirectMessagesChatTopicMessages
  ) where

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

-- | Removes all pinned messages from the topic in a channel direct messages chat administered by the current user. Returns 'TD.Data.Ok.Ok'
data UnpinAllDirectMessagesChatTopicMessages
  = UnpinAllDirectMessagesChatTopicMessages
    { UnpinAllDirectMessagesChatTopicMessages -> Maybe Int
chat_id  :: Maybe Int -- ^ Identifier of the chat
    , UnpinAllDirectMessagesChatTopicMessages -> Maybe Int
topic_id :: Maybe Int -- ^ Topic identifier
    }
  deriving (UnpinAllDirectMessagesChatTopicMessages
-> UnpinAllDirectMessagesChatTopicMessages -> Bool
(UnpinAllDirectMessagesChatTopicMessages
 -> UnpinAllDirectMessagesChatTopicMessages -> Bool)
-> (UnpinAllDirectMessagesChatTopicMessages
    -> UnpinAllDirectMessagesChatTopicMessages -> Bool)
-> Eq UnpinAllDirectMessagesChatTopicMessages
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UnpinAllDirectMessagesChatTopicMessages
-> UnpinAllDirectMessagesChatTopicMessages -> Bool
== :: UnpinAllDirectMessagesChatTopicMessages
-> UnpinAllDirectMessagesChatTopicMessages -> Bool
$c/= :: UnpinAllDirectMessagesChatTopicMessages
-> UnpinAllDirectMessagesChatTopicMessages -> Bool
/= :: UnpinAllDirectMessagesChatTopicMessages
-> UnpinAllDirectMessagesChatTopicMessages -> Bool
Eq, Int -> UnpinAllDirectMessagesChatTopicMessages -> ShowS
[UnpinAllDirectMessagesChatTopicMessages] -> ShowS
UnpinAllDirectMessagesChatTopicMessages -> String
(Int -> UnpinAllDirectMessagesChatTopicMessages -> ShowS)
-> (UnpinAllDirectMessagesChatTopicMessages -> String)
-> ([UnpinAllDirectMessagesChatTopicMessages] -> ShowS)
-> Show UnpinAllDirectMessagesChatTopicMessages
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UnpinAllDirectMessagesChatTopicMessages -> ShowS
showsPrec :: Int -> UnpinAllDirectMessagesChatTopicMessages -> ShowS
$cshow :: UnpinAllDirectMessagesChatTopicMessages -> String
show :: UnpinAllDirectMessagesChatTopicMessages -> String
$cshowList :: [UnpinAllDirectMessagesChatTopicMessages] -> ShowS
showList :: [UnpinAllDirectMessagesChatTopicMessages] -> ShowS
Show)

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

instance AT.ToJSON UnpinAllDirectMessagesChatTopicMessages where
  toJSON :: UnpinAllDirectMessagesChatTopicMessages -> Value
toJSON
    UnpinAllDirectMessagesChatTopicMessages
      { chat_id :: UnpinAllDirectMessagesChatTopicMessages -> Maybe Int
chat_id  = Maybe Int
chat_id_
      , topic_id :: UnpinAllDirectMessagesChatTopicMessages -> Maybe Int
topic_id = Maybe Int
topic_id_
      }
        = [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
"unpinAllDirectMessagesChatTopicMessages"
          , 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
"topic_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
topic_id_
          ]

defaultUnpinAllDirectMessagesChatTopicMessages :: UnpinAllDirectMessagesChatTopicMessages
defaultUnpinAllDirectMessagesChatTopicMessages :: UnpinAllDirectMessagesChatTopicMessages
defaultUnpinAllDirectMessagesChatTopicMessages =
  UnpinAllDirectMessagesChatTopicMessages
    { chat_id :: Maybe Int
chat_id  = Maybe Int
forall a. Maybe a
Nothing
    , topic_id :: Maybe Int
topic_id = Maybe Int
forall a. Maybe a
Nothing
    }