module TD.Query.GetUpgradedGiftVariants
  (GetUpgradedGiftVariants(..)
  , defaultGetUpgradedGiftVariants
  ) where

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

-- | Returns all possible variants of upgraded gifts for a regular gift. Returns 'TD.Data.GiftUpgradeVariants.GiftUpgradeVariants'
data GetUpgradedGiftVariants
  = GetUpgradedGiftVariants
    { GetUpgradedGiftVariants -> Maybe Int
regular_gift_id       :: Maybe Int  -- ^ Identifier of the regular gift
    , GetUpgradedGiftVariants -> Maybe Bool
return_upgrade_models :: Maybe Bool -- ^ Pass true to get models that can be obtained by upgrading a regular gift
    , GetUpgradedGiftVariants -> Maybe Bool
return_craft_models   :: Maybe Bool -- ^ Pass true to get models that can be obtained by crafting a gift from upgraded gifts
    }
  deriving (GetUpgradedGiftVariants -> GetUpgradedGiftVariants -> Bool
(GetUpgradedGiftVariants -> GetUpgradedGiftVariants -> Bool)
-> (GetUpgradedGiftVariants -> GetUpgradedGiftVariants -> Bool)
-> Eq GetUpgradedGiftVariants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetUpgradedGiftVariants -> GetUpgradedGiftVariants -> Bool
== :: GetUpgradedGiftVariants -> GetUpgradedGiftVariants -> Bool
$c/= :: GetUpgradedGiftVariants -> GetUpgradedGiftVariants -> Bool
/= :: GetUpgradedGiftVariants -> GetUpgradedGiftVariants -> Bool
Eq, Int -> GetUpgradedGiftVariants -> ShowS
[GetUpgradedGiftVariants] -> ShowS
GetUpgradedGiftVariants -> String
(Int -> GetUpgradedGiftVariants -> ShowS)
-> (GetUpgradedGiftVariants -> String)
-> ([GetUpgradedGiftVariants] -> ShowS)
-> Show GetUpgradedGiftVariants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetUpgradedGiftVariants -> ShowS
showsPrec :: Int -> GetUpgradedGiftVariants -> ShowS
$cshow :: GetUpgradedGiftVariants -> String
show :: GetUpgradedGiftVariants -> String
$cshowList :: [GetUpgradedGiftVariants] -> ShowS
showList :: [GetUpgradedGiftVariants] -> ShowS
Show)

instance I.ShortShow GetUpgradedGiftVariants where
  shortShow :: GetUpgradedGiftVariants -> String
shortShow
    GetUpgradedGiftVariants
      { regular_gift_id :: GetUpgradedGiftVariants -> Maybe Int
regular_gift_id       = Maybe Int
regular_gift_id_
      , return_upgrade_models :: GetUpgradedGiftVariants -> Maybe Bool
return_upgrade_models = Maybe Bool
return_upgrade_models_
      , return_craft_models :: GetUpgradedGiftVariants -> Maybe Bool
return_craft_models   = Maybe Bool
return_craft_models_
      }
        = String
"GetUpgradedGiftVariants"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"regular_gift_id"       String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
regular_gift_id_
          , String
"return_upgrade_models" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
return_upgrade_models_
          , String
"return_craft_models"   String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
return_craft_models_
          ]

instance AT.ToJSON GetUpgradedGiftVariants where
  toJSON :: GetUpgradedGiftVariants -> Value
toJSON
    GetUpgradedGiftVariants
      { regular_gift_id :: GetUpgradedGiftVariants -> Maybe Int
regular_gift_id       = Maybe Int
regular_gift_id_
      , return_upgrade_models :: GetUpgradedGiftVariants -> Maybe Bool
return_upgrade_models = Maybe Bool
return_upgrade_models_
      , return_craft_models :: GetUpgradedGiftVariants -> Maybe Bool
return_craft_models   = Maybe Bool
return_craft_models_
      }
        = [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
"getUpgradedGiftVariants"
          , Key
"regular_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
regular_gift_id_
          , Key
"return_upgrade_models" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
return_upgrade_models_
          , Key
"return_craft_models"   Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
return_craft_models_
          ]

defaultGetUpgradedGiftVariants :: GetUpgradedGiftVariants
defaultGetUpgradedGiftVariants :: GetUpgradedGiftVariants
defaultGetUpgradedGiftVariants =
  GetUpgradedGiftVariants
    { regular_gift_id :: Maybe Int
regular_gift_id       = Maybe Int
forall a. Maybe a
Nothing
    , return_upgrade_models :: Maybe Bool
return_upgrade_models = Maybe Bool
forall a. Maybe a
Nothing
    , return_craft_models :: Maybe Bool
return_craft_models   = Maybe Bool
forall a. Maybe a
Nothing
    }