module TD.Query.GetChatBoostLinkInfo
  (GetChatBoostLinkInfo(..)
  ) 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

-- | Returns information about a link to boost a chat. Can be called for any internal link of the type internalLinkTypeChatBoost. Returns 'TD.Data.ChatBoostLinkInfo.ChatBoostLinkInfo'
data GetChatBoostLinkInfo
  = GetChatBoostLinkInfo
    { GetChatBoostLinkInfo -> Maybe Text
url :: Maybe T.Text -- ^ The link to boost a chat
    }
  deriving (GetChatBoostLinkInfo -> GetChatBoostLinkInfo -> Bool
(GetChatBoostLinkInfo -> GetChatBoostLinkInfo -> Bool)
-> (GetChatBoostLinkInfo -> GetChatBoostLinkInfo -> Bool)
-> Eq GetChatBoostLinkInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetChatBoostLinkInfo -> GetChatBoostLinkInfo -> Bool
== :: GetChatBoostLinkInfo -> GetChatBoostLinkInfo -> Bool
$c/= :: GetChatBoostLinkInfo -> GetChatBoostLinkInfo -> Bool
/= :: GetChatBoostLinkInfo -> GetChatBoostLinkInfo -> Bool
Eq, Int -> GetChatBoostLinkInfo -> ShowS
[GetChatBoostLinkInfo] -> ShowS
GetChatBoostLinkInfo -> String
(Int -> GetChatBoostLinkInfo -> ShowS)
-> (GetChatBoostLinkInfo -> String)
-> ([GetChatBoostLinkInfo] -> ShowS)
-> Show GetChatBoostLinkInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetChatBoostLinkInfo -> ShowS
showsPrec :: Int -> GetChatBoostLinkInfo -> ShowS
$cshow :: GetChatBoostLinkInfo -> String
show :: GetChatBoostLinkInfo -> String
$cshowList :: [GetChatBoostLinkInfo] -> ShowS
showList :: [GetChatBoostLinkInfo] -> ShowS
Show)

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

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