module TD.Query.GetPremiumLimit
  (GetPremiumLimit(..)
  ) where

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

-- | Returns information about a limit, increased for Premium users. Returns a 404 error if the limit is unknown. Returns 'TD.Data.PremiumLimit.PremiumLimit'
data GetPremiumLimit
  = GetPremiumLimit
    { GetPremiumLimit -> Maybe PremiumLimitType
limit_type :: Maybe PremiumLimitType.PremiumLimitType -- ^ Type of the limit
    }
  deriving (GetPremiumLimit -> GetPremiumLimit -> Bool
(GetPremiumLimit -> GetPremiumLimit -> Bool)
-> (GetPremiumLimit -> GetPremiumLimit -> Bool)
-> Eq GetPremiumLimit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetPremiumLimit -> GetPremiumLimit -> Bool
== :: GetPremiumLimit -> GetPremiumLimit -> Bool
$c/= :: GetPremiumLimit -> GetPremiumLimit -> Bool
/= :: GetPremiumLimit -> GetPremiumLimit -> Bool
Eq, Int -> GetPremiumLimit -> ShowS
[GetPremiumLimit] -> ShowS
GetPremiumLimit -> String
(Int -> GetPremiumLimit -> ShowS)
-> (GetPremiumLimit -> String)
-> ([GetPremiumLimit] -> ShowS)
-> Show GetPremiumLimit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetPremiumLimit -> ShowS
showsPrec :: Int -> GetPremiumLimit -> ShowS
$cshow :: GetPremiumLimit -> String
show :: GetPremiumLimit -> String
$cshowList :: [GetPremiumLimit] -> ShowS
showList :: [GetPremiumLimit] -> ShowS
Show)

instance I.ShortShow GetPremiumLimit where
  shortShow :: GetPremiumLimit -> String
shortShow
    GetPremiumLimit
      { limit_type :: GetPremiumLimit -> Maybe PremiumLimitType
limit_type = Maybe PremiumLimitType
limit_type_
      }
        = String
"GetPremiumLimit"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"limit_type" String -> Maybe PremiumLimitType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PremiumLimitType
limit_type_
          ]

instance AT.ToJSON GetPremiumLimit where
  toJSON :: GetPremiumLimit -> Value
toJSON
    GetPremiumLimit
      { limit_type :: GetPremiumLimit -> Maybe PremiumLimitType
limit_type = Maybe PremiumLimitType
limit_type_
      }
        = [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
"getPremiumLimit"
          , Key
"limit_type" Key -> Maybe PremiumLimitType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe PremiumLimitType
limit_type_
          ]