module TD.Query.GetUpgradedGift
  (GetUpgradedGift(..)
  ) 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

-- | Returns information about an upgraded gift by its name. Returns 'TD.Data.UpgradedGift.UpgradedGift'
data GetUpgradedGift
  = GetUpgradedGift
    { GetUpgradedGift -> Maybe Text
name :: Maybe T.Text -- ^ Unique name of the upgraded gift
    }
  deriving (GetUpgradedGift -> GetUpgradedGift -> Bool
(GetUpgradedGift -> GetUpgradedGift -> Bool)
-> (GetUpgradedGift -> GetUpgradedGift -> Bool)
-> Eq GetUpgradedGift
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetUpgradedGift -> GetUpgradedGift -> Bool
== :: GetUpgradedGift -> GetUpgradedGift -> Bool
$c/= :: GetUpgradedGift -> GetUpgradedGift -> Bool
/= :: GetUpgradedGift -> GetUpgradedGift -> Bool
Eq, Int -> GetUpgradedGift -> ShowS
[GetUpgradedGift] -> ShowS
GetUpgradedGift -> String
(Int -> GetUpgradedGift -> ShowS)
-> (GetUpgradedGift -> String)
-> ([GetUpgradedGift] -> ShowS)
-> Show GetUpgradedGift
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetUpgradedGift -> ShowS
showsPrec :: Int -> GetUpgradedGift -> ShowS
$cshow :: GetUpgradedGift -> String
show :: GetUpgradedGift -> String
$cshowList :: [GetUpgradedGift] -> ShowS
showList :: [GetUpgradedGift] -> ShowS
Show)

instance I.ShortShow GetUpgradedGift where
  shortShow :: GetUpgradedGift -> String
shortShow
    GetUpgradedGift
      { name :: GetUpgradedGift -> Maybe Text
name = Maybe Text
name_
      }
        = String
"GetUpgradedGift"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"name" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
name_
          ]

instance AT.ToJSON GetUpgradedGift where
  toJSON :: GetUpgradedGift -> Value
toJSON
    GetUpgradedGift
      { name :: GetUpgradedGift -> Maybe Text
name = Maybe Text
name_
      }
        = [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
"getUpgradedGift"
          , Key
"name"  Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
name_
          ]