module TD.Query.GetStarGiftPaymentOptions
  (GetStarGiftPaymentOptions(..)
  ) where

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

-- | Returns available options for Telegram Stars gifting. Returns 'TD.Data.StarPaymentOptions.StarPaymentOptions'
data GetStarGiftPaymentOptions
  = GetStarGiftPaymentOptions
    { GetStarGiftPaymentOptions -> Maybe Int
user_id :: Maybe Int -- ^ Identifier of the user that will receive Telegram Stars; pass 0 to get options for an unspecified user
    }
  deriving (GetStarGiftPaymentOptions -> GetStarGiftPaymentOptions -> Bool
(GetStarGiftPaymentOptions -> GetStarGiftPaymentOptions -> Bool)
-> (GetStarGiftPaymentOptions -> GetStarGiftPaymentOptions -> Bool)
-> Eq GetStarGiftPaymentOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetStarGiftPaymentOptions -> GetStarGiftPaymentOptions -> Bool
== :: GetStarGiftPaymentOptions -> GetStarGiftPaymentOptions -> Bool
$c/= :: GetStarGiftPaymentOptions -> GetStarGiftPaymentOptions -> Bool
/= :: GetStarGiftPaymentOptions -> GetStarGiftPaymentOptions -> Bool
Eq, Int -> GetStarGiftPaymentOptions -> ShowS
[GetStarGiftPaymentOptions] -> ShowS
GetStarGiftPaymentOptions -> String
(Int -> GetStarGiftPaymentOptions -> ShowS)
-> (GetStarGiftPaymentOptions -> String)
-> ([GetStarGiftPaymentOptions] -> ShowS)
-> Show GetStarGiftPaymentOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetStarGiftPaymentOptions -> ShowS
showsPrec :: Int -> GetStarGiftPaymentOptions -> ShowS
$cshow :: GetStarGiftPaymentOptions -> String
show :: GetStarGiftPaymentOptions -> String
$cshowList :: [GetStarGiftPaymentOptions] -> ShowS
showList :: [GetStarGiftPaymentOptions] -> ShowS
Show)

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

instance AT.ToJSON GetStarGiftPaymentOptions where
  toJSON :: GetStarGiftPaymentOptions -> Value
toJSON
    GetStarGiftPaymentOptions
      { user_id :: GetStarGiftPaymentOptions -> Maybe Int
user_id = Maybe Int
user_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
"getStarGiftPaymentOptions"
          , Key
"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
user_id_
          ]