module TD.Query.GetCountryCode
  (GetCountryCode(..)
  ) where

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

-- | Uses the current IP address to find the current country. Returns two-letter ISO 3166-1 alpha-2 country code. Can be called before authorization. Returns 'TD.Data.Text.Text'
data GetCountryCode
  = GetCountryCode
  deriving (GetCountryCode -> GetCountryCode -> Bool
(GetCountryCode -> GetCountryCode -> Bool)
-> (GetCountryCode -> GetCountryCode -> Bool) -> Eq GetCountryCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetCountryCode -> GetCountryCode -> Bool
== :: GetCountryCode -> GetCountryCode -> Bool
$c/= :: GetCountryCode -> GetCountryCode -> Bool
/= :: GetCountryCode -> GetCountryCode -> Bool
Eq, Int -> GetCountryCode -> ShowS
[GetCountryCode] -> ShowS
GetCountryCode -> String
(Int -> GetCountryCode -> ShowS)
-> (GetCountryCode -> String)
-> ([GetCountryCode] -> ShowS)
-> Show GetCountryCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetCountryCode -> ShowS
showsPrec :: Int -> GetCountryCode -> ShowS
$cshow :: GetCountryCode -> String
show :: GetCountryCode -> String
$cshowList :: [GetCountryCode] -> ShowS
showList :: [GetCountryCode] -> ShowS
Show)

instance I.ShortShow GetCountryCode where
  shortShow :: GetCountryCode -> String
shortShow
    GetCountryCode
GetCountryCode
        = String
"GetCountryCode"

instance AT.ToJSON GetCountryCode where
  toJSON :: GetCountryCode -> Value
toJSON
    GetCountryCode
GetCountryCode
        = [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
"getCountryCode"
          ]