module TD.Query.SetBotProfilePhoto
  (SetBotProfilePhoto(..)
  , defaultSetBotProfilePhoto
  ) 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.InputChatPhoto as InputChatPhoto

-- | Changes a profile photo for a bot. Returns 'TD.Data.Ok.Ok'
data SetBotProfilePhoto
  = SetBotProfilePhoto
    { SetBotProfilePhoto -> Maybe Int
bot_user_id :: Maybe Int                           -- ^ Identifier of the target bot
    , SetBotProfilePhoto -> Maybe InputChatPhoto
photo       :: Maybe InputChatPhoto.InputChatPhoto -- ^ Profile photo to set; pass null to delete the chat photo
    }
  deriving (SetBotProfilePhoto -> SetBotProfilePhoto -> Bool
(SetBotProfilePhoto -> SetBotProfilePhoto -> Bool)
-> (SetBotProfilePhoto -> SetBotProfilePhoto -> Bool)
-> Eq SetBotProfilePhoto
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetBotProfilePhoto -> SetBotProfilePhoto -> Bool
== :: SetBotProfilePhoto -> SetBotProfilePhoto -> Bool
$c/= :: SetBotProfilePhoto -> SetBotProfilePhoto -> Bool
/= :: SetBotProfilePhoto -> SetBotProfilePhoto -> Bool
Eq, Int -> SetBotProfilePhoto -> ShowS
[SetBotProfilePhoto] -> ShowS
SetBotProfilePhoto -> String
(Int -> SetBotProfilePhoto -> ShowS)
-> (SetBotProfilePhoto -> String)
-> ([SetBotProfilePhoto] -> ShowS)
-> Show SetBotProfilePhoto
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetBotProfilePhoto -> ShowS
showsPrec :: Int -> SetBotProfilePhoto -> ShowS
$cshow :: SetBotProfilePhoto -> String
show :: SetBotProfilePhoto -> String
$cshowList :: [SetBotProfilePhoto] -> ShowS
showList :: [SetBotProfilePhoto] -> ShowS
Show)

instance I.ShortShow SetBotProfilePhoto where
  shortShow :: SetBotProfilePhoto -> String
shortShow
    SetBotProfilePhoto
      { bot_user_id :: SetBotProfilePhoto -> Maybe Int
bot_user_id = Maybe Int
bot_user_id_
      , photo :: SetBotProfilePhoto -> Maybe InputChatPhoto
photo       = Maybe InputChatPhoto
photo_
      }
        = String
"SetBotProfilePhoto"
          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
"photo"       String -> Maybe InputChatPhoto -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputChatPhoto
photo_
          ]

instance AT.ToJSON SetBotProfilePhoto where
  toJSON :: SetBotProfilePhoto -> Value
toJSON
    SetBotProfilePhoto
      { bot_user_id :: SetBotProfilePhoto -> Maybe Int
bot_user_id = Maybe Int
bot_user_id_
      , photo :: SetBotProfilePhoto -> Maybe InputChatPhoto
photo       = Maybe InputChatPhoto
photo_
      }
        = [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
"setBotProfilePhoto"
          , 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
"photo"       Key -> Maybe InputChatPhoto -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputChatPhoto
photo_
          ]

defaultSetBotProfilePhoto :: SetBotProfilePhoto
defaultSetBotProfilePhoto :: SetBotProfilePhoto
defaultSetBotProfilePhoto =
  SetBotProfilePhoto
    { bot_user_id :: Maybe Int
bot_user_id = Maybe Int
forall a. Maybe a
Nothing
    , photo :: Maybe InputChatPhoto
photo       = Maybe InputChatPhoto
forall a. Maybe a
Nothing
    }