module TD.Query.SetBusinessConnectedBot
  (SetBusinessConnectedBot(..)
  ) 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.BusinessConnectedBot as BusinessConnectedBot

-- | Adds or changes business bot that is connected to the current user account. Returns 'TD.Data.Ok.Ok'
data SetBusinessConnectedBot
  = SetBusinessConnectedBot
    { SetBusinessConnectedBot -> Maybe BusinessConnectedBot
bot :: Maybe BusinessConnectedBot.BusinessConnectedBot -- ^ Connection settings for the bot
    }
  deriving (SetBusinessConnectedBot -> SetBusinessConnectedBot -> Bool
(SetBusinessConnectedBot -> SetBusinessConnectedBot -> Bool)
-> (SetBusinessConnectedBot -> SetBusinessConnectedBot -> Bool)
-> Eq SetBusinessConnectedBot
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetBusinessConnectedBot -> SetBusinessConnectedBot -> Bool
== :: SetBusinessConnectedBot -> SetBusinessConnectedBot -> Bool
$c/= :: SetBusinessConnectedBot -> SetBusinessConnectedBot -> Bool
/= :: SetBusinessConnectedBot -> SetBusinessConnectedBot -> Bool
Eq, Int -> SetBusinessConnectedBot -> ShowS
[SetBusinessConnectedBot] -> ShowS
SetBusinessConnectedBot -> String
(Int -> SetBusinessConnectedBot -> ShowS)
-> (SetBusinessConnectedBot -> String)
-> ([SetBusinessConnectedBot] -> ShowS)
-> Show SetBusinessConnectedBot
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetBusinessConnectedBot -> ShowS
showsPrec :: Int -> SetBusinessConnectedBot -> ShowS
$cshow :: SetBusinessConnectedBot -> String
show :: SetBusinessConnectedBot -> String
$cshowList :: [SetBusinessConnectedBot] -> ShowS
showList :: [SetBusinessConnectedBot] -> ShowS
Show)

instance I.ShortShow SetBusinessConnectedBot where
  shortShow :: SetBusinessConnectedBot -> String
shortShow
    SetBusinessConnectedBot
      { bot :: SetBusinessConnectedBot -> Maybe BusinessConnectedBot
bot = Maybe BusinessConnectedBot
bot_
      }
        = String
"SetBusinessConnectedBot"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"bot" String -> Maybe BusinessConnectedBot -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe BusinessConnectedBot
bot_
          ]

instance AT.ToJSON SetBusinessConnectedBot where
  toJSON :: SetBusinessConnectedBot -> Value
toJSON
    SetBusinessConnectedBot
      { bot :: SetBusinessConnectedBot -> Maybe BusinessConnectedBot
bot = Maybe BusinessConnectedBot
bot_
      }
        = [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
"setBusinessConnectedBot"
          , Key
"bot"   Key -> Maybe BusinessConnectedBot -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe BusinessConnectedBot
bot_
          ]