module TD.Query.SetProfileShareTheme
  (SetProfileShareTheme(..)
  , defaultSetProfileShareTheme
  ) 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.InputProfileShareTheme as InputProfileShareTheme

-- | Changes the theme of the screen for sharing a link to the current user or a chat. The chat must have a username. Requires can_change_info administrator right in supergroups and channels. Returns 'TD.Data.Ok.Ok'
data SetProfileShareTheme
  = SetProfileShareTheme
    { SetProfileShareTheme -> Maybe Int
chat_id :: Maybe Int                                           -- ^ Identifier of the chat with the current user, or identifier of a supergroup or a channel chat
    , SetProfileShareTheme -> Maybe InputProfileShareTheme
theme   :: Maybe InputProfileShareTheme.InputProfileShareTheme -- ^ The new theme; pass null to use the default theme
    }
  deriving (SetProfileShareTheme -> SetProfileShareTheme -> Bool
(SetProfileShareTheme -> SetProfileShareTheme -> Bool)
-> (SetProfileShareTheme -> SetProfileShareTheme -> Bool)
-> Eq SetProfileShareTheme
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetProfileShareTheme -> SetProfileShareTheme -> Bool
== :: SetProfileShareTheme -> SetProfileShareTheme -> Bool
$c/= :: SetProfileShareTheme -> SetProfileShareTheme -> Bool
/= :: SetProfileShareTheme -> SetProfileShareTheme -> Bool
Eq, Int -> SetProfileShareTheme -> ShowS
[SetProfileShareTheme] -> ShowS
SetProfileShareTheme -> String
(Int -> SetProfileShareTheme -> ShowS)
-> (SetProfileShareTheme -> String)
-> ([SetProfileShareTheme] -> ShowS)
-> Show SetProfileShareTheme
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetProfileShareTheme -> ShowS
showsPrec :: Int -> SetProfileShareTheme -> ShowS
$cshow :: SetProfileShareTheme -> String
show :: SetProfileShareTheme -> String
$cshowList :: [SetProfileShareTheme] -> ShowS
showList :: [SetProfileShareTheme] -> ShowS
Show)

instance I.ShortShow SetProfileShareTheme where
  shortShow :: SetProfileShareTheme -> String
shortShow
    SetProfileShareTheme
      { chat_id :: SetProfileShareTheme -> Maybe Int
chat_id = Maybe Int
chat_id_
      , theme :: SetProfileShareTheme -> Maybe InputProfileShareTheme
theme   = Maybe InputProfileShareTheme
theme_
      }
        = String
"SetProfileShareTheme"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"chat_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
          , String
"theme"   String -> Maybe InputProfileShareTheme -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputProfileShareTheme
theme_
          ]

instance AT.ToJSON SetProfileShareTheme where
  toJSON :: SetProfileShareTheme -> Value
toJSON
    SetProfileShareTheme
      { chat_id :: SetProfileShareTheme -> Maybe Int
chat_id = Maybe Int
chat_id_
      , theme :: SetProfileShareTheme -> Maybe InputProfileShareTheme
theme   = Maybe InputProfileShareTheme
theme_
      }
        = [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
"setProfileShareTheme"
          , Key
"chat_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
chat_id_
          , Key
"theme"   Key -> Maybe InputProfileShareTheme -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputProfileShareTheme
theme_
          ]

defaultSetProfileShareTheme :: SetProfileShareTheme
defaultSetProfileShareTheme :: SetProfileShareTheme
defaultSetProfileShareTheme =
  SetProfileShareTheme
    { chat_id :: Maybe Int
chat_id = Maybe Int
forall a. Maybe a
Nothing
    , theme :: Maybe InputProfileShareTheme
theme   = Maybe InputProfileShareTheme
forall a. Maybe a
Nothing
    }