module TD.Query.SetBusinessAccountProfilePhoto
  (SetBusinessAccountProfilePhoto(..)
  , defaultSetBusinessAccountProfilePhoto
  ) 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
import qualified TD.Data.InputChatPhoto as InputChatPhoto

-- | Changes a profile photo of a business account; for bots only. Returns 'TD.Data.Ok.Ok'
data SetBusinessAccountProfilePhoto
  = SetBusinessAccountProfilePhoto
    { SetBusinessAccountProfilePhoto -> Maybe Text
business_connection_id :: Maybe T.Text                        -- ^ Unique identifier of business connection
    , SetBusinessAccountProfilePhoto -> Maybe InputChatPhoto
photo                  :: Maybe InputChatPhoto.InputChatPhoto -- ^ Profile photo to set; pass null to remove the photo
    , SetBusinessAccountProfilePhoto -> Maybe Bool
is_public              :: Maybe Bool                          -- ^ Pass true to set the public photo, which will be visible even the main photo is hidden by privacy settings
    }
  deriving (SetBusinessAccountProfilePhoto
-> SetBusinessAccountProfilePhoto -> Bool
(SetBusinessAccountProfilePhoto
 -> SetBusinessAccountProfilePhoto -> Bool)
-> (SetBusinessAccountProfilePhoto
    -> SetBusinessAccountProfilePhoto -> Bool)
-> Eq SetBusinessAccountProfilePhoto
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetBusinessAccountProfilePhoto
-> SetBusinessAccountProfilePhoto -> Bool
== :: SetBusinessAccountProfilePhoto
-> SetBusinessAccountProfilePhoto -> Bool
$c/= :: SetBusinessAccountProfilePhoto
-> SetBusinessAccountProfilePhoto -> Bool
/= :: SetBusinessAccountProfilePhoto
-> SetBusinessAccountProfilePhoto -> Bool
Eq, Int -> SetBusinessAccountProfilePhoto -> ShowS
[SetBusinessAccountProfilePhoto] -> ShowS
SetBusinessAccountProfilePhoto -> String
(Int -> SetBusinessAccountProfilePhoto -> ShowS)
-> (SetBusinessAccountProfilePhoto -> String)
-> ([SetBusinessAccountProfilePhoto] -> ShowS)
-> Show SetBusinessAccountProfilePhoto
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetBusinessAccountProfilePhoto -> ShowS
showsPrec :: Int -> SetBusinessAccountProfilePhoto -> ShowS
$cshow :: SetBusinessAccountProfilePhoto -> String
show :: SetBusinessAccountProfilePhoto -> String
$cshowList :: [SetBusinessAccountProfilePhoto] -> ShowS
showList :: [SetBusinessAccountProfilePhoto] -> ShowS
Show)

instance I.ShortShow SetBusinessAccountProfilePhoto where
  shortShow :: SetBusinessAccountProfilePhoto -> String
shortShow
    SetBusinessAccountProfilePhoto
      { business_connection_id :: SetBusinessAccountProfilePhoto -> Maybe Text
business_connection_id = Maybe Text
business_connection_id_
      , photo :: SetBusinessAccountProfilePhoto -> Maybe InputChatPhoto
photo                  = Maybe InputChatPhoto
photo_
      , is_public :: SetBusinessAccountProfilePhoto -> Maybe Bool
is_public              = Maybe Bool
is_public_
      }
        = String
"SetBusinessAccountProfilePhoto"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"business_connection_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
business_connection_id_
          , String
"photo"                  String -> Maybe InputChatPhoto -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputChatPhoto
photo_
          , String
"is_public"              String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_public_
          ]

instance AT.ToJSON SetBusinessAccountProfilePhoto where
  toJSON :: SetBusinessAccountProfilePhoto -> Value
toJSON
    SetBusinessAccountProfilePhoto
      { business_connection_id :: SetBusinessAccountProfilePhoto -> Maybe Text
business_connection_id = Maybe Text
business_connection_id_
      , photo :: SetBusinessAccountProfilePhoto -> Maybe InputChatPhoto
photo                  = Maybe InputChatPhoto
photo_
      , is_public :: SetBusinessAccountProfilePhoto -> Maybe Bool
is_public              = Maybe Bool
is_public_
      }
        = [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
"setBusinessAccountProfilePhoto"
          , Key
"business_connection_id" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
business_connection_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_
          , Key
"is_public"              Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
is_public_
          ]

defaultSetBusinessAccountProfilePhoto :: SetBusinessAccountProfilePhoto
defaultSetBusinessAccountProfilePhoto :: SetBusinessAccountProfilePhoto
defaultSetBusinessAccountProfilePhoto =
  SetBusinessAccountProfilePhoto
    { business_connection_id :: Maybe Text
business_connection_id = Maybe Text
forall a. Maybe a
Nothing
    , photo :: Maybe InputChatPhoto
photo                  = Maybe InputChatPhoto
forall a. Maybe a
Nothing
    , is_public :: Maybe Bool
is_public              = Maybe Bool
forall a. Maybe a
Nothing
    }