module TD.Query.EditBusinessChatLink
  (EditBusinessChatLink(..)
  , defaultEditBusinessChatLink
  ) 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
import qualified TD.Data.InputBusinessChatLink as InputBusinessChatLink

-- | Edits a business chat link of the current account. Requires Telegram Business subscription. Returns the edited link. Returns 'TD.Data.BusinessChatLink.BusinessChatLink'
data EditBusinessChatLink
  = EditBusinessChatLink
    { EditBusinessChatLink -> Maybe Text
link      :: Maybe T.Text                                      -- ^ The link to edit
    , EditBusinessChatLink -> Maybe InputBusinessChatLink
link_info :: Maybe InputBusinessChatLink.InputBusinessChatLink -- ^ New description of the link
    }
  deriving (EditBusinessChatLink -> EditBusinessChatLink -> Bool
(EditBusinessChatLink -> EditBusinessChatLink -> Bool)
-> (EditBusinessChatLink -> EditBusinessChatLink -> Bool)
-> Eq EditBusinessChatLink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EditBusinessChatLink -> EditBusinessChatLink -> Bool
== :: EditBusinessChatLink -> EditBusinessChatLink -> Bool
$c/= :: EditBusinessChatLink -> EditBusinessChatLink -> Bool
/= :: EditBusinessChatLink -> EditBusinessChatLink -> Bool
Eq, Int -> EditBusinessChatLink -> ShowS
[EditBusinessChatLink] -> ShowS
EditBusinessChatLink -> String
(Int -> EditBusinessChatLink -> ShowS)
-> (EditBusinessChatLink -> String)
-> ([EditBusinessChatLink] -> ShowS)
-> Show EditBusinessChatLink
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EditBusinessChatLink -> ShowS
showsPrec :: Int -> EditBusinessChatLink -> ShowS
$cshow :: EditBusinessChatLink -> String
show :: EditBusinessChatLink -> String
$cshowList :: [EditBusinessChatLink] -> ShowS
showList :: [EditBusinessChatLink] -> ShowS
Show)

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

instance AT.ToJSON EditBusinessChatLink where
  toJSON :: EditBusinessChatLink -> Value
toJSON
    EditBusinessChatLink
      { link :: EditBusinessChatLink -> Maybe Text
link      = Maybe Text
link_
      , link_info :: EditBusinessChatLink -> 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
"editBusinessChatLink"
          , Key
"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
link_
          , 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_
          ]

defaultEditBusinessChatLink :: EditBusinessChatLink
defaultEditBusinessChatLink :: EditBusinessChatLink
defaultEditBusinessChatLink =
  EditBusinessChatLink
    { link :: Maybe Text
link      = Maybe Text
forall a. Maybe a
Nothing
    , link_info :: Maybe InputBusinessChatLink
link_info = Maybe InputBusinessChatLink
forall a. Maybe a
Nothing
    }