module TD.Query.SetBotInfoDescription
  (SetBotInfoDescription(..)
  , defaultSetBotInfoDescription
  ) 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

-- | Sets the text shown in the chat with a bot if the chat is empty. Can be called only if userTypeBot.can_be_edited == true. Returns 'TD.Data.Ok.Ok'
data SetBotInfoDescription
  = SetBotInfoDescription
    { SetBotInfoDescription -> Maybe Int
bot_user_id   :: Maybe Int    -- ^ Identifier of the target bot
    , SetBotInfoDescription -> Maybe Text
language_code :: Maybe T.Text -- ^ A two-letter ISO 639-1 language code. If empty, the description will be shown to all users for whose languages there is no dedicated description
    , SetBotInfoDescription -> Maybe Text
description   :: Maybe T.Text -- ^ New bot's description on the specified language
    }
  deriving (SetBotInfoDescription -> SetBotInfoDescription -> Bool
(SetBotInfoDescription -> SetBotInfoDescription -> Bool)
-> (SetBotInfoDescription -> SetBotInfoDescription -> Bool)
-> Eq SetBotInfoDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetBotInfoDescription -> SetBotInfoDescription -> Bool
== :: SetBotInfoDescription -> SetBotInfoDescription -> Bool
$c/= :: SetBotInfoDescription -> SetBotInfoDescription -> Bool
/= :: SetBotInfoDescription -> SetBotInfoDescription -> Bool
Eq, Int -> SetBotInfoDescription -> ShowS
[SetBotInfoDescription] -> ShowS
SetBotInfoDescription -> String
(Int -> SetBotInfoDescription -> ShowS)
-> (SetBotInfoDescription -> String)
-> ([SetBotInfoDescription] -> ShowS)
-> Show SetBotInfoDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetBotInfoDescription -> ShowS
showsPrec :: Int -> SetBotInfoDescription -> ShowS
$cshow :: SetBotInfoDescription -> String
show :: SetBotInfoDescription -> String
$cshowList :: [SetBotInfoDescription] -> ShowS
showList :: [SetBotInfoDescription] -> ShowS
Show)

instance I.ShortShow SetBotInfoDescription where
  shortShow :: SetBotInfoDescription -> String
shortShow
    SetBotInfoDescription
      { bot_user_id :: SetBotInfoDescription -> Maybe Int
bot_user_id   = Maybe Int
bot_user_id_
      , language_code :: SetBotInfoDescription -> Maybe Text
language_code = Maybe Text
language_code_
      , description :: SetBotInfoDescription -> Maybe Text
description   = Maybe Text
description_
      }
        = String
"SetBotInfoDescription"
          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
"language_code" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
language_code_
          , String
"description"   String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
description_
          ]

instance AT.ToJSON SetBotInfoDescription where
  toJSON :: SetBotInfoDescription -> Value
toJSON
    SetBotInfoDescription
      { bot_user_id :: SetBotInfoDescription -> Maybe Int
bot_user_id   = Maybe Int
bot_user_id_
      , language_code :: SetBotInfoDescription -> Maybe Text
language_code = Maybe Text
language_code_
      , description :: SetBotInfoDescription -> Maybe Text
description   = Maybe Text
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
"setBotInfoDescription"
          , 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
"language_code" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
language_code_
          , Key
"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
description_
          ]

defaultSetBotInfoDescription :: SetBotInfoDescription
defaultSetBotInfoDescription :: SetBotInfoDescription
defaultSetBotInfoDescription =
  SetBotInfoDescription
    { bot_user_id :: Maybe Int
bot_user_id   = Maybe Int
forall a. Maybe a
Nothing
    , language_code :: Maybe Text
language_code = Maybe Text
forall a. Maybe a
Nothing
    , description :: Maybe Text
description   = Maybe Text
forall a. Maybe a
Nothing
    }