module TD.Query.CreateBusinessChatLink
  (CreateBusinessChatLink(..)
  ) 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.InputBusinessChatLink as InputBusinessChatLink

-- | Creates a business chat link for the current account. Requires Telegram Business subscription. There can be up to getOption("business_chat_link_count_max") links created. Returns the created link. Returns 'TD.Data.BusinessChatLink.BusinessChatLink'
data CreateBusinessChatLink
  = CreateBusinessChatLink
    { CreateBusinessChatLink -> Maybe InputBusinessChatLink
link_info :: Maybe InputBusinessChatLink.InputBusinessChatLink -- ^ Information about the link to create
    }
  deriving (CreateBusinessChatLink -> CreateBusinessChatLink -> Bool
(CreateBusinessChatLink -> CreateBusinessChatLink -> Bool)
-> (CreateBusinessChatLink -> CreateBusinessChatLink -> Bool)
-> Eq CreateBusinessChatLink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CreateBusinessChatLink -> CreateBusinessChatLink -> Bool
== :: CreateBusinessChatLink -> CreateBusinessChatLink -> Bool
$c/= :: CreateBusinessChatLink -> CreateBusinessChatLink -> Bool
/= :: CreateBusinessChatLink -> CreateBusinessChatLink -> Bool
Eq, Int -> CreateBusinessChatLink -> ShowS
[CreateBusinessChatLink] -> ShowS
CreateBusinessChatLink -> String
(Int -> CreateBusinessChatLink -> ShowS)
-> (CreateBusinessChatLink -> String)
-> ([CreateBusinessChatLink] -> ShowS)
-> Show CreateBusinessChatLink
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateBusinessChatLink -> ShowS
showsPrec :: Int -> CreateBusinessChatLink -> ShowS
$cshow :: CreateBusinessChatLink -> String
show :: CreateBusinessChatLink -> String
$cshowList :: [CreateBusinessChatLink] -> ShowS
showList :: [CreateBusinessChatLink] -> ShowS
Show)

instance I.ShortShow CreateBusinessChatLink where
  shortShow :: CreateBusinessChatLink -> String
shortShow
    CreateBusinessChatLink
      { link_info :: CreateBusinessChatLink -> Maybe InputBusinessChatLink
link_info = Maybe InputBusinessChatLink
link_info_
      }
        = String
"CreateBusinessChatLink"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"link_info" String -> Maybe InputBusinessChatLink -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputBusinessChatLink
link_info_
          ]

instance AT.ToJSON CreateBusinessChatLink where
  toJSON :: CreateBusinessChatLink -> Value
toJSON
    CreateBusinessChatLink
      { link_info :: CreateBusinessChatLink -> Maybe InputBusinessChatLink
link_info = Maybe InputBusinessChatLink
link_info_
      }
        = [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
"createBusinessChatLink"
          , Key
"link_info" Key -> Maybe InputBusinessChatLink -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputBusinessChatLink
link_info_
          ]