module TD.Query.ViewSponsoredChat
  (ViewSponsoredChat(..)
  ) where

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

-- | Informs TDLib that the user fully viewed a sponsored chat. Returns 'TD.Data.Ok.Ok'
data ViewSponsoredChat
  = ViewSponsoredChat
    {  :: Maybe Int -- ^ Unique identifier of the sponsored chat
    }
  deriving (ViewSponsoredChat -> ViewSponsoredChat -> Bool
(ViewSponsoredChat -> ViewSponsoredChat -> Bool)
-> (ViewSponsoredChat -> ViewSponsoredChat -> Bool)
-> Eq ViewSponsoredChat
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ViewSponsoredChat -> ViewSponsoredChat -> Bool
== :: ViewSponsoredChat -> ViewSponsoredChat -> Bool
$c/= :: ViewSponsoredChat -> ViewSponsoredChat -> Bool
/= :: ViewSponsoredChat -> ViewSponsoredChat -> Bool
Eq, Int -> ViewSponsoredChat -> ShowS
[ViewSponsoredChat] -> ShowS
ViewSponsoredChat -> String
(Int -> ViewSponsoredChat -> ShowS)
-> (ViewSponsoredChat -> String)
-> ([ViewSponsoredChat] -> ShowS)
-> Show ViewSponsoredChat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ViewSponsoredChat -> ShowS
showsPrec :: Int -> ViewSponsoredChat -> ShowS
$cshow :: ViewSponsoredChat -> String
show :: ViewSponsoredChat -> String
$cshowList :: [ViewSponsoredChat] -> ShowS
showList :: [ViewSponsoredChat] -> ShowS
Show)

instance I.ShortShow ViewSponsoredChat where
  shortShow :: ViewSponsoredChat -> String
shortShow
    ViewSponsoredChat
      { sponsored_chat_unique_id :: ViewSponsoredChat -> Maybe Int
sponsored_chat_unique_id = Maybe Int
sponsored_chat_unique_id_
      }
        = String
"ViewSponsoredChat"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"sponsored_chat_unique_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
sponsored_chat_unique_id_
          ]

instance AT.ToJSON ViewSponsoredChat where
  toJSON :: ViewSponsoredChat -> Value
toJSON
    ViewSponsoredChat
      { sponsored_chat_unique_id :: ViewSponsoredChat -> Maybe Int
sponsored_chat_unique_id = Maybe Int
sponsored_chat_unique_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
"viewSponsoredChat"
          , Key
"sponsored_chat_unique_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
sponsored_chat_unique_id_
          ]