module TD.Query.SellGift
  (SellGift(..)
  , defaultSellGift
  ) 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

-- | Sells a gift for Telegram Stars. Returns 'TD.Data.Ok.Ok'
data SellGift
  = SellGift
    { SellGift -> Maybe Text
business_connection_id :: Maybe T.Text -- ^ Unique identifier of business connection on behalf of which to send the request; for bots only
    , SellGift -> Maybe Text
received_gift_id       :: Maybe T.Text -- ^ Identifier of the gift
    }
  deriving (SellGift -> SellGift -> Bool
(SellGift -> SellGift -> Bool)
-> (SellGift -> SellGift -> Bool) -> Eq SellGift
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SellGift -> SellGift -> Bool
== :: SellGift -> SellGift -> Bool
$c/= :: SellGift -> SellGift -> Bool
/= :: SellGift -> SellGift -> Bool
Eq, Int -> SellGift -> ShowS
[SellGift] -> ShowS
SellGift -> String
(Int -> SellGift -> ShowS)
-> (SellGift -> String) -> ([SellGift] -> ShowS) -> Show SellGift
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SellGift -> ShowS
showsPrec :: Int -> SellGift -> ShowS
$cshow :: SellGift -> String
show :: SellGift -> String
$cshowList :: [SellGift] -> ShowS
showList :: [SellGift] -> ShowS
Show)

instance I.ShortShow SellGift where
  shortShow :: SellGift -> String
shortShow
    SellGift
      { business_connection_id :: SellGift -> Maybe Text
business_connection_id = Maybe Text
business_connection_id_
      , received_gift_id :: SellGift -> Maybe Text
received_gift_id       = Maybe Text
received_gift_id_
      }
        = String
"SellGift"
          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
"received_gift_id"       String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
received_gift_id_
          ]

instance AT.ToJSON SellGift where
  toJSON :: SellGift -> Value
toJSON
    SellGift
      { business_connection_id :: SellGift -> Maybe Text
business_connection_id = Maybe Text
business_connection_id_
      , received_gift_id :: SellGift -> Maybe Text
received_gift_id       = Maybe Text
received_gift_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
"sellGift"
          , 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
"received_gift_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
received_gift_id_
          ]

defaultSellGift :: SellGift
defaultSellGift :: SellGift
defaultSellGift =
  SellGift
    { business_connection_id :: Maybe Text
business_connection_id = Maybe Text
forall a. Maybe a
Nothing
    , received_gift_id :: Maybe Text
received_gift_id       = Maybe Text
forall a. Maybe a
Nothing
    }