module TD.Query.GetGiftAuctionAcquiredGifts
  (GetGiftAuctionAcquiredGifts(..)
  ) where

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

-- | Returns the gifts that were acquired by the current user on a gift auction. Returns 'TD.Data.GiftAuctionAcquiredGifts.GiftAuctionAcquiredGifts'
data GetGiftAuctionAcquiredGifts
  = GetGiftAuctionAcquiredGifts
    { GetGiftAuctionAcquiredGifts -> Maybe Int
gift_id :: Maybe Int -- ^ Identifier of the auctioned gift
    }
  deriving (GetGiftAuctionAcquiredGifts -> GetGiftAuctionAcquiredGifts -> Bool
(GetGiftAuctionAcquiredGifts
 -> GetGiftAuctionAcquiredGifts -> Bool)
-> (GetGiftAuctionAcquiredGifts
    -> GetGiftAuctionAcquiredGifts -> Bool)
-> Eq GetGiftAuctionAcquiredGifts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetGiftAuctionAcquiredGifts -> GetGiftAuctionAcquiredGifts -> Bool
== :: GetGiftAuctionAcquiredGifts -> GetGiftAuctionAcquiredGifts -> Bool
$c/= :: GetGiftAuctionAcquiredGifts -> GetGiftAuctionAcquiredGifts -> Bool
/= :: GetGiftAuctionAcquiredGifts -> GetGiftAuctionAcquiredGifts -> Bool
Eq, Int -> GetGiftAuctionAcquiredGifts -> ShowS
[GetGiftAuctionAcquiredGifts] -> ShowS
GetGiftAuctionAcquiredGifts -> String
(Int -> GetGiftAuctionAcquiredGifts -> ShowS)
-> (GetGiftAuctionAcquiredGifts -> String)
-> ([GetGiftAuctionAcquiredGifts] -> ShowS)
-> Show GetGiftAuctionAcquiredGifts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetGiftAuctionAcquiredGifts -> ShowS
showsPrec :: Int -> GetGiftAuctionAcquiredGifts -> ShowS
$cshow :: GetGiftAuctionAcquiredGifts -> String
show :: GetGiftAuctionAcquiredGifts -> String
$cshowList :: [GetGiftAuctionAcquiredGifts] -> ShowS
showList :: [GetGiftAuctionAcquiredGifts] -> ShowS
Show)

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

instance AT.ToJSON GetGiftAuctionAcquiredGifts where
  toJSON :: GetGiftAuctionAcquiredGifts -> Value
toJSON
    GetGiftAuctionAcquiredGifts
      { gift_id :: GetGiftAuctionAcquiredGifts -> Maybe Int
gift_id = Maybe Int
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
"getGiftAuctionAcquiredGifts"
          , Key
"gift_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
gift_id_
          ]