module TD.Query.GetPremiumFeatures
  (GetPremiumFeatures(..)
  ) 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.PremiumSource as PremiumSource

-- | Returns information about features, available to Premium users. Returns 'TD.Data.PremiumFeatures.PremiumFeatures'
data GetPremiumFeatures
  = GetPremiumFeatures
    { GetPremiumFeatures -> Maybe PremiumSource
source :: Maybe PremiumSource.PremiumSource -- ^ Source of the request; pass null if the method is called from some non-standard source
    }
  deriving (GetPremiumFeatures -> GetPremiumFeatures -> Bool
(GetPremiumFeatures -> GetPremiumFeatures -> Bool)
-> (GetPremiumFeatures -> GetPremiumFeatures -> Bool)
-> Eq GetPremiumFeatures
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetPremiumFeatures -> GetPremiumFeatures -> Bool
== :: GetPremiumFeatures -> GetPremiumFeatures -> Bool
$c/= :: GetPremiumFeatures -> GetPremiumFeatures -> Bool
/= :: GetPremiumFeatures -> GetPremiumFeatures -> Bool
Eq, Int -> GetPremiumFeatures -> ShowS
[GetPremiumFeatures] -> ShowS
GetPremiumFeatures -> String
(Int -> GetPremiumFeatures -> ShowS)
-> (GetPremiumFeatures -> String)
-> ([GetPremiumFeatures] -> ShowS)
-> Show GetPremiumFeatures
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetPremiumFeatures -> ShowS
showsPrec :: Int -> GetPremiumFeatures -> ShowS
$cshow :: GetPremiumFeatures -> String
show :: GetPremiumFeatures -> String
$cshowList :: [GetPremiumFeatures] -> ShowS
showList :: [GetPremiumFeatures] -> ShowS
Show)

instance I.ShortShow GetPremiumFeatures where
  shortShow :: GetPremiumFeatures -> String
shortShow
    GetPremiumFeatures
      { source :: GetPremiumFeatures -> Maybe PremiumSource
source = Maybe PremiumSource
source_
      }
        = String
"GetPremiumFeatures"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"source" String -> Maybe PremiumSource -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe PremiumSource
source_
          ]

instance AT.ToJSON GetPremiumFeatures where
  toJSON :: GetPremiumFeatures -> Value
toJSON
    GetPremiumFeatures
      { source :: GetPremiumFeatures -> Maybe PremiumSource
source = Maybe PremiumSource
source_
      }
        = [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
"getPremiumFeatures"
          , Key
"source" Key -> Maybe PremiumSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe PremiumSource
source_
          ]