module TD.Query.SetMainProfileTab
  (SetMainProfileTab(..)
  ) 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.ProfileTab as ProfileTab

-- | Changes the main profile tab of the current user. Returns 'TD.Data.Ok.Ok'
data SetMainProfileTab
  = SetMainProfileTab
    { SetMainProfileTab -> Maybe ProfileTab
main_profile_tab :: Maybe ProfileTab.ProfileTab -- ^ The new value of the main profile tab
    }
  deriving (SetMainProfileTab -> SetMainProfileTab -> Bool
(SetMainProfileTab -> SetMainProfileTab -> Bool)
-> (SetMainProfileTab -> SetMainProfileTab -> Bool)
-> Eq SetMainProfileTab
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetMainProfileTab -> SetMainProfileTab -> Bool
== :: SetMainProfileTab -> SetMainProfileTab -> Bool
$c/= :: SetMainProfileTab -> SetMainProfileTab -> Bool
/= :: SetMainProfileTab -> SetMainProfileTab -> Bool
Eq, Int -> SetMainProfileTab -> ShowS
[SetMainProfileTab] -> ShowS
SetMainProfileTab -> String
(Int -> SetMainProfileTab -> ShowS)
-> (SetMainProfileTab -> String)
-> ([SetMainProfileTab] -> ShowS)
-> Show SetMainProfileTab
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetMainProfileTab -> ShowS
showsPrec :: Int -> SetMainProfileTab -> ShowS
$cshow :: SetMainProfileTab -> String
show :: SetMainProfileTab -> String
$cshowList :: [SetMainProfileTab] -> ShowS
showList :: [SetMainProfileTab] -> ShowS
Show)

instance I.ShortShow SetMainProfileTab where
  shortShow :: SetMainProfileTab -> String
shortShow
    SetMainProfileTab
      { main_profile_tab :: SetMainProfileTab -> Maybe ProfileTab
main_profile_tab = Maybe ProfileTab
main_profile_tab_
      }
        = String
"SetMainProfileTab"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"main_profile_tab" String -> Maybe ProfileTab -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ProfileTab
main_profile_tab_
          ]

instance AT.ToJSON SetMainProfileTab where
  toJSON :: SetMainProfileTab -> Value
toJSON
    SetMainProfileTab
      { main_profile_tab :: SetMainProfileTab -> Maybe ProfileTab
main_profile_tab = Maybe ProfileTab
main_profile_tab_
      }
        = [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
"setMainProfileTab"
          , Key
"main_profile_tab" Key -> Maybe ProfileTab -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ProfileTab
main_profile_tab_
          ]