module TD.Query.ToggleChatFolderTags
  (ToggleChatFolderTags(..)
  ) where

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

-- | Toggles whether chat folder tags are enabled. Returns 'TD.Data.Ok.Ok'
data ToggleChatFolderTags
  = ToggleChatFolderTags
    { ToggleChatFolderTags -> Maybe Bool
are_tags_enabled :: Maybe Bool -- ^ Pass true to enable folder tags; pass false to disable them
    }
  deriving (ToggleChatFolderTags -> ToggleChatFolderTags -> Bool
(ToggleChatFolderTags -> ToggleChatFolderTags -> Bool)
-> (ToggleChatFolderTags -> ToggleChatFolderTags -> Bool)
-> Eq ToggleChatFolderTags
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ToggleChatFolderTags -> ToggleChatFolderTags -> Bool
== :: ToggleChatFolderTags -> ToggleChatFolderTags -> Bool
$c/= :: ToggleChatFolderTags -> ToggleChatFolderTags -> Bool
/= :: ToggleChatFolderTags -> ToggleChatFolderTags -> Bool
Eq, Int -> ToggleChatFolderTags -> ShowS
[ToggleChatFolderTags] -> ShowS
ToggleChatFolderTags -> String
(Int -> ToggleChatFolderTags -> ShowS)
-> (ToggleChatFolderTags -> String)
-> ([ToggleChatFolderTags] -> ShowS)
-> Show ToggleChatFolderTags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ToggleChatFolderTags -> ShowS
showsPrec :: Int -> ToggleChatFolderTags -> ShowS
$cshow :: ToggleChatFolderTags -> String
show :: ToggleChatFolderTags -> String
$cshowList :: [ToggleChatFolderTags] -> ShowS
showList :: [ToggleChatFolderTags] -> ShowS
Show)

instance I.ShortShow ToggleChatFolderTags where
  shortShow :: ToggleChatFolderTags -> String
shortShow
    ToggleChatFolderTags
      { are_tags_enabled :: ToggleChatFolderTags -> Maybe Bool
are_tags_enabled = Maybe Bool
are_tags_enabled_
      }
        = String
"ToggleChatFolderTags"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"are_tags_enabled" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
are_tags_enabled_
          ]

instance AT.ToJSON ToggleChatFolderTags where
  toJSON :: ToggleChatFolderTags -> Value
toJSON
    ToggleChatFolderTags
      { are_tags_enabled :: ToggleChatFolderTags -> Maybe Bool
are_tags_enabled = Maybe Bool
are_tags_enabled_
      }
        = [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
"toggleChatFolderTags"
          , Key
"are_tags_enabled" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
are_tags_enabled_
          ]