module TD.Query.CheckChatInviteLink
  (CheckChatInviteLink(..)
  ) where

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

-- | Checks the validity of an invite link for a chat and returns information about the corresponding chat. Returns 'TD.Data.ChatInviteLinkInfo.ChatInviteLinkInfo'
data CheckChatInviteLink
  = CheckChatInviteLink
    { CheckChatInviteLink -> Maybe Text
invite_link :: Maybe T.Text -- ^ Invite link to be checked
    }
  deriving (CheckChatInviteLink -> CheckChatInviteLink -> Bool
(CheckChatInviteLink -> CheckChatInviteLink -> Bool)
-> (CheckChatInviteLink -> CheckChatInviteLink -> Bool)
-> Eq CheckChatInviteLink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CheckChatInviteLink -> CheckChatInviteLink -> Bool
== :: CheckChatInviteLink -> CheckChatInviteLink -> Bool
$c/= :: CheckChatInviteLink -> CheckChatInviteLink -> Bool
/= :: CheckChatInviteLink -> CheckChatInviteLink -> Bool
Eq, Int -> CheckChatInviteLink -> ShowS
[CheckChatInviteLink] -> ShowS
CheckChatInviteLink -> String
(Int -> CheckChatInviteLink -> ShowS)
-> (CheckChatInviteLink -> String)
-> ([CheckChatInviteLink] -> ShowS)
-> Show CheckChatInviteLink
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CheckChatInviteLink -> ShowS
showsPrec :: Int -> CheckChatInviteLink -> ShowS
$cshow :: CheckChatInviteLink -> String
show :: CheckChatInviteLink -> String
$cshowList :: [CheckChatInviteLink] -> ShowS
showList :: [CheckChatInviteLink] -> ShowS
Show)

instance I.ShortShow CheckChatInviteLink where
  shortShow :: CheckChatInviteLink -> String
shortShow
    CheckChatInviteLink
      { invite_link :: CheckChatInviteLink -> Maybe Text
invite_link = Maybe Text
invite_link_
      }
        = String
"CheckChatInviteLink"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"invite_link" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
invite_link_
          ]

instance AT.ToJSON CheckChatInviteLink where
  toJSON :: CheckChatInviteLink -> Value
toJSON
    CheckChatInviteLink
      { invite_link :: CheckChatInviteLink -> Maybe Text
invite_link = Maybe Text
invite_link_
      }
        = [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
"checkChatInviteLink"
          , Key
"invite_link" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
invite_link_
          ]