module TD.Query.SetBotInfoShortDescription
  (SetBotInfoShortDescription(..)
  , defaultSetBotInfoShortDescription
  ) 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 on a bot's profile page and sent together with the link when users share the bot. Can be called only if userTypeBot.can_be_edited == true. Returns 'TD.Data.Ok.Ok'
data SetBotInfoShortDescription
  = SetBotInfoShortDescription
    { SetBotInfoShortDescription -> Maybe Int
bot_user_id       :: Maybe Int    -- ^ Identifier of the target bot
    , SetBotInfoShortDescription -> Maybe Text
language_code     :: Maybe T.Text -- ^ A two-letter ISO 639-1 language code. If empty, the short description will be shown to all users for whose languages there is no dedicated description
    , SetBotInfoShortDescription -> Maybe Text
short_description :: Maybe T.Text -- ^ New bot's short description on the specified language
    }
  deriving (SetBotInfoShortDescription -> SetBotInfoShortDescription -> Bool
(SetBotInfoShortDescription -> SetBotInfoShortDescription -> Bool)
-> (SetBotInfoShortDescription
    -> SetBotInfoShortDescription -> Bool)
-> Eq SetBotInfoShortDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetBotInfoShortDescription -> SetBotInfoShortDescription -> Bool
== :: SetBotInfoShortDescription -> SetBotInfoShortDescription -> Bool
$c/= :: SetBotInfoShortDescription -> SetBotInfoShortDescription -> Bool
/= :: SetBotInfoShortDescription -> SetBotInfoShortDescription -> Bool
Eq, Int -> SetBotInfoShortDescription -> ShowS
[SetBotInfoShortDescription] -> ShowS
SetBotInfoShortDescription -> String
(Int -> SetBotInfoShortDescription -> ShowS)
-> (SetBotInfoShortDescription -> String)
-> ([SetBotInfoShortDescription] -> ShowS)
-> Show SetBotInfoShortDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetBotInfoShortDescription -> ShowS
showsPrec :: Int -> SetBotInfoShortDescription -> ShowS
$cshow :: SetBotInfoShortDescription -> String
show :: SetBotInfoShortDescription -> String
$cshowList :: [SetBotInfoShortDescription] -> ShowS
showList :: [SetBotInfoShortDescription] -> ShowS
Show)

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

instance AT.ToJSON SetBotInfoShortDescription where
  toJSON :: SetBotInfoShortDescription -> Value
toJSON
    SetBotInfoShortDescription
      { bot_user_id :: SetBotInfoShortDescription -> Maybe Int
bot_user_id       = Maybe Int
bot_user_id_
      , language_code :: SetBotInfoShortDescription -> Maybe Text
language_code     = Maybe Text
language_code_
      , short_description :: SetBotInfoShortDescription -> Maybe Text
short_description = Maybe Text
short_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
"setBotInfoShortDescription"
          , 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
"short_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
short_description_
          ]

defaultSetBotInfoShortDescription :: SetBotInfoShortDescription
defaultSetBotInfoShortDescription :: SetBotInfoShortDescription
defaultSetBotInfoShortDescription =
  SetBotInfoShortDescription
    { 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
    , short_description :: Maybe Text
short_description = Maybe Text
forall a. Maybe a
Nothing
    }