module TD.Query.IncreaseGiftAuctionBid
  (IncreaseGiftAuctionBid(..)
  , defaultIncreaseGiftAuctionBid
  ) where

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

-- | Increases a bid for an auction gift without changing gift text and receiver. Returns 'TD.Data.Ok.Ok'
data IncreaseGiftAuctionBid
  = IncreaseGiftAuctionBid
    { IncreaseGiftAuctionBid -> Maybe Int
gift_id    :: Maybe Int -- ^ Identifier of the gift to put the bid on
    , IncreaseGiftAuctionBid -> Maybe Int
star_count :: Maybe Int -- ^ The number of Telegram Stars to put in the bid
    }
  deriving (IncreaseGiftAuctionBid -> IncreaseGiftAuctionBid -> Bool
(IncreaseGiftAuctionBid -> IncreaseGiftAuctionBid -> Bool)
-> (IncreaseGiftAuctionBid -> IncreaseGiftAuctionBid -> Bool)
-> Eq IncreaseGiftAuctionBid
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: IncreaseGiftAuctionBid -> IncreaseGiftAuctionBid -> Bool
== :: IncreaseGiftAuctionBid -> IncreaseGiftAuctionBid -> Bool
$c/= :: IncreaseGiftAuctionBid -> IncreaseGiftAuctionBid -> Bool
/= :: IncreaseGiftAuctionBid -> IncreaseGiftAuctionBid -> Bool
Eq, Int -> IncreaseGiftAuctionBid -> ShowS
[IncreaseGiftAuctionBid] -> ShowS
IncreaseGiftAuctionBid -> String
(Int -> IncreaseGiftAuctionBid -> ShowS)
-> (IncreaseGiftAuctionBid -> String)
-> ([IncreaseGiftAuctionBid] -> ShowS)
-> Show IncreaseGiftAuctionBid
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> IncreaseGiftAuctionBid -> ShowS
showsPrec :: Int -> IncreaseGiftAuctionBid -> ShowS
$cshow :: IncreaseGiftAuctionBid -> String
show :: IncreaseGiftAuctionBid -> String
$cshowList :: [IncreaseGiftAuctionBid] -> ShowS
showList :: [IncreaseGiftAuctionBid] -> ShowS
Show)

instance I.ShortShow IncreaseGiftAuctionBid where
  shortShow :: IncreaseGiftAuctionBid -> String
shortShow
    IncreaseGiftAuctionBid
      { gift_id :: IncreaseGiftAuctionBid -> Maybe Int
gift_id    = Maybe Int
gift_id_
      , star_count :: IncreaseGiftAuctionBid -> Maybe Int
star_count = Maybe Int
star_count_
      }
        = String
"IncreaseGiftAuctionBid"
          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_
          , String
"star_count" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
star_count_
          ]

instance AT.ToJSON IncreaseGiftAuctionBid where
  toJSON :: IncreaseGiftAuctionBid -> Value
toJSON
    IncreaseGiftAuctionBid
      { gift_id :: IncreaseGiftAuctionBid -> Maybe Int
gift_id    = Maybe Int
gift_id_
      , star_count :: IncreaseGiftAuctionBid -> Maybe Int
star_count = Maybe Int
star_count_
      }
        = [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
"increaseGiftAuctionBid"
          , 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_
          , Key
"star_count" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
star_count_
          ]

defaultIncreaseGiftAuctionBid :: IncreaseGiftAuctionBid
defaultIncreaseGiftAuctionBid :: IncreaseGiftAuctionBid
defaultIncreaseGiftAuctionBid =
  IncreaseGiftAuctionBid
    { gift_id :: Maybe Int
gift_id    = Maybe Int
forall a. Maybe a
Nothing
    , star_count :: Maybe Int
star_count = Maybe Int
forall a. Maybe a
Nothing
    }