module TD.Query.SetMessageSenderBotVerification
  (SetMessageSenderBotVerification(..)
  , defaultSetMessageSenderBotVerification
  ) 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.MessageSender as MessageSender
import qualified Data.Text as T

-- | Changes the verification status of a user or a chat by an owned bot. Returns 'TD.Data.Ok.Ok'
data SetMessageSenderBotVerification
  = SetMessageSenderBotVerification
    { SetMessageSenderBotVerification -> Maybe Int
bot_user_id        :: Maybe Int                         -- ^ Identifier of the owned bot, which will verify the user or the chat
    , SetMessageSenderBotVerification -> Maybe MessageSender
verified_id        :: Maybe MessageSender.MessageSender -- ^ Identifier of the user or the supergroup or channel chat, which will be verified by the bot
    , SetMessageSenderBotVerification -> Maybe Text
custom_description :: Maybe T.Text                      -- ^ Custom description of verification reason; 0-getOption("bot_verification_custom_description_length_max"). If empty, then "was verified by organization "organization_name"" will be used as description. Can be specified only if the bot is allowed to provide custom description
    }
  deriving (SetMessageSenderBotVerification
-> SetMessageSenderBotVerification -> Bool
(SetMessageSenderBotVerification
 -> SetMessageSenderBotVerification -> Bool)
-> (SetMessageSenderBotVerification
    -> SetMessageSenderBotVerification -> Bool)
-> Eq SetMessageSenderBotVerification
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetMessageSenderBotVerification
-> SetMessageSenderBotVerification -> Bool
== :: SetMessageSenderBotVerification
-> SetMessageSenderBotVerification -> Bool
$c/= :: SetMessageSenderBotVerification
-> SetMessageSenderBotVerification -> Bool
/= :: SetMessageSenderBotVerification
-> SetMessageSenderBotVerification -> Bool
Eq, Int -> SetMessageSenderBotVerification -> ShowS
[SetMessageSenderBotVerification] -> ShowS
SetMessageSenderBotVerification -> String
(Int -> SetMessageSenderBotVerification -> ShowS)
-> (SetMessageSenderBotVerification -> String)
-> ([SetMessageSenderBotVerification] -> ShowS)
-> Show SetMessageSenderBotVerification
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetMessageSenderBotVerification -> ShowS
showsPrec :: Int -> SetMessageSenderBotVerification -> ShowS
$cshow :: SetMessageSenderBotVerification -> String
show :: SetMessageSenderBotVerification -> String
$cshowList :: [SetMessageSenderBotVerification] -> ShowS
showList :: [SetMessageSenderBotVerification] -> ShowS
Show)

instance I.ShortShow SetMessageSenderBotVerification where
  shortShow :: SetMessageSenderBotVerification -> String
shortShow
    SetMessageSenderBotVerification
      { bot_user_id :: SetMessageSenderBotVerification -> Maybe Int
bot_user_id        = Maybe Int
bot_user_id_
      , verified_id :: SetMessageSenderBotVerification -> Maybe MessageSender
verified_id        = Maybe MessageSender
verified_id_
      , custom_description :: SetMessageSenderBotVerification -> Maybe Text
custom_description = Maybe Text
custom_description_
      }
        = String
"SetMessageSenderBotVerification"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"bot_user_id"        String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
bot_user_id_
          , String
"verified_id"        String -> Maybe MessageSender -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe MessageSender
verified_id_
          , String
"custom_description" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
custom_description_
          ]

instance AT.ToJSON SetMessageSenderBotVerification where
  toJSON :: SetMessageSenderBotVerification -> Value
toJSON
    SetMessageSenderBotVerification
      { bot_user_id :: SetMessageSenderBotVerification -> Maybe Int
bot_user_id        = Maybe Int
bot_user_id_
      , verified_id :: SetMessageSenderBotVerification -> Maybe MessageSender
verified_id        = Maybe MessageSender
verified_id_
      , custom_description :: SetMessageSenderBotVerification -> Maybe Text
custom_description = Maybe Text
custom_description_
      }
        = [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
"setMessageSenderBotVerification"
          , Key
"bot_user_id"        Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
bot_user_id_
          , Key
"verified_id"        Key -> Maybe MessageSender -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe MessageSender
verified_id_
          , Key
"custom_description" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
custom_description_
          ]

defaultSetMessageSenderBotVerification :: SetMessageSenderBotVerification
defaultSetMessageSenderBotVerification :: SetMessageSenderBotVerification
defaultSetMessageSenderBotVerification =
  SetMessageSenderBotVerification
    { bot_user_id :: Maybe Int
bot_user_id        = Maybe Int
forall a. Maybe a
Nothing
    , verified_id :: Maybe MessageSender
verified_id        = Maybe MessageSender
forall a. Maybe a
Nothing
    , custom_description :: Maybe Text
custom_description = Maybe Text
forall a. Maybe a
Nothing
    }