module TD.Query.GetThemeParametersJsonString
  (GetThemeParametersJsonString(..)
  ) 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.ThemeParameters as ThemeParameters

-- | Converts a themeParameters object to corresponding JSON-serialized string. Can be called synchronously. Returns 'TD.Data.Text.Text'
data GetThemeParametersJsonString
  = GetThemeParametersJsonString
    { GetThemeParametersJsonString -> Maybe ThemeParameters
theme :: Maybe ThemeParameters.ThemeParameters -- ^ Theme parameters to convert to JSON
    }
  deriving (GetThemeParametersJsonString
-> GetThemeParametersJsonString -> Bool
(GetThemeParametersJsonString
 -> GetThemeParametersJsonString -> Bool)
-> (GetThemeParametersJsonString
    -> GetThemeParametersJsonString -> Bool)
-> Eq GetThemeParametersJsonString
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetThemeParametersJsonString
-> GetThemeParametersJsonString -> Bool
== :: GetThemeParametersJsonString
-> GetThemeParametersJsonString -> Bool
$c/= :: GetThemeParametersJsonString
-> GetThemeParametersJsonString -> Bool
/= :: GetThemeParametersJsonString
-> GetThemeParametersJsonString -> Bool
Eq, Int -> GetThemeParametersJsonString -> ShowS
[GetThemeParametersJsonString] -> ShowS
GetThemeParametersJsonString -> String
(Int -> GetThemeParametersJsonString -> ShowS)
-> (GetThemeParametersJsonString -> String)
-> ([GetThemeParametersJsonString] -> ShowS)
-> Show GetThemeParametersJsonString
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetThemeParametersJsonString -> ShowS
showsPrec :: Int -> GetThemeParametersJsonString -> ShowS
$cshow :: GetThemeParametersJsonString -> String
show :: GetThemeParametersJsonString -> String
$cshowList :: [GetThemeParametersJsonString] -> ShowS
showList :: [GetThemeParametersJsonString] -> ShowS
Show)

instance I.ShortShow GetThemeParametersJsonString where
  shortShow :: GetThemeParametersJsonString -> String
shortShow
    GetThemeParametersJsonString
      { theme :: GetThemeParametersJsonString -> Maybe ThemeParameters
theme = Maybe ThemeParameters
theme_
      }
        = String
"GetThemeParametersJsonString"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"theme" String -> Maybe ThemeParameters -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ThemeParameters
theme_
          ]

instance AT.ToJSON GetThemeParametersJsonString where
  toJSON :: GetThemeParametersJsonString -> Value
toJSON
    GetThemeParametersJsonString
      { theme :: GetThemeParametersJsonString -> Maybe ThemeParameters
theme = Maybe ThemeParameters
theme_
      }
        = [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
"getThemeParametersJsonString"
          , Key
"theme" Key -> Maybe ThemeParameters -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ThemeParameters
theme_
          ]