module TD.Query.SetUpgradedGiftColors
  (SetUpgradedGiftColors(..)
  ) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I

-- | Changes color scheme for the current user based on an owned or a hosted upgraded gift; for Telegram Premium users only. Returns 'TD.Data.Ok.Ok'
data SetUpgradedGiftColors
  = SetUpgradedGiftColors
    { SetUpgradedGiftColors -> Maybe Int
upgraded_gift_colors_id :: Maybe Int -- ^ Identifier of the upgradedGiftColors scheme to use
    }
  deriving (SetUpgradedGiftColors -> SetUpgradedGiftColors -> Bool
(SetUpgradedGiftColors -> SetUpgradedGiftColors -> Bool)
-> (SetUpgradedGiftColors -> SetUpgradedGiftColors -> Bool)
-> Eq SetUpgradedGiftColors
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetUpgradedGiftColors -> SetUpgradedGiftColors -> Bool
== :: SetUpgradedGiftColors -> SetUpgradedGiftColors -> Bool
$c/= :: SetUpgradedGiftColors -> SetUpgradedGiftColors -> Bool
/= :: SetUpgradedGiftColors -> SetUpgradedGiftColors -> Bool
Eq, Int -> SetUpgradedGiftColors -> ShowS
[SetUpgradedGiftColors] -> ShowS
SetUpgradedGiftColors -> String
(Int -> SetUpgradedGiftColors -> ShowS)
-> (SetUpgradedGiftColors -> String)
-> ([SetUpgradedGiftColors] -> ShowS)
-> Show SetUpgradedGiftColors
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetUpgradedGiftColors -> ShowS
showsPrec :: Int -> SetUpgradedGiftColors -> ShowS
$cshow :: SetUpgradedGiftColors -> String
show :: SetUpgradedGiftColors -> String
$cshowList :: [SetUpgradedGiftColors] -> ShowS
showList :: [SetUpgradedGiftColors] -> ShowS
Show)

instance I.ShortShow SetUpgradedGiftColors where
  shortShow :: SetUpgradedGiftColors -> String
shortShow
    SetUpgradedGiftColors
      { upgraded_gift_colors_id :: SetUpgradedGiftColors -> Maybe Int
upgraded_gift_colors_id = Maybe Int
upgraded_gift_colors_id_
      }
        = String
"SetUpgradedGiftColors"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"upgraded_gift_colors_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
upgraded_gift_colors_id_
          ]

instance AT.ToJSON SetUpgradedGiftColors where
  toJSON :: SetUpgradedGiftColors -> Value
toJSON
    SetUpgradedGiftColors
      { upgraded_gift_colors_id :: SetUpgradedGiftColors -> Maybe Int
upgraded_gift_colors_id = Maybe Int
upgraded_gift_colors_id_
      }
        = [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
"setUpgradedGiftColors"
          , Key
"upgraded_gift_colors_id" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (Int -> Value) -> Maybe Int -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Value
I.writeInt64  Maybe Int
upgraded_gift_colors_id_
          ]