module TD.Query.GetChatFolderDefaultIconName
  (GetChatFolderDefaultIconName(..)
  ) 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.ChatFolder as ChatFolder

-- | Returns default icon name for a folder. Can be called synchronously. Returns 'TD.Data.ChatFolderIcon.ChatFolderIcon'
data GetChatFolderDefaultIconName
  = GetChatFolderDefaultIconName
    { GetChatFolderDefaultIconName -> Maybe ChatFolder
folder :: Maybe ChatFolder.ChatFolder -- ^ Chat folder
    }
  deriving (GetChatFolderDefaultIconName
-> GetChatFolderDefaultIconName -> Bool
(GetChatFolderDefaultIconName
 -> GetChatFolderDefaultIconName -> Bool)
-> (GetChatFolderDefaultIconName
    -> GetChatFolderDefaultIconName -> Bool)
-> Eq GetChatFolderDefaultIconName
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetChatFolderDefaultIconName
-> GetChatFolderDefaultIconName -> Bool
== :: GetChatFolderDefaultIconName
-> GetChatFolderDefaultIconName -> Bool
$c/= :: GetChatFolderDefaultIconName
-> GetChatFolderDefaultIconName -> Bool
/= :: GetChatFolderDefaultIconName
-> GetChatFolderDefaultIconName -> Bool
Eq, Int -> GetChatFolderDefaultIconName -> ShowS
[GetChatFolderDefaultIconName] -> ShowS
GetChatFolderDefaultIconName -> String
(Int -> GetChatFolderDefaultIconName -> ShowS)
-> (GetChatFolderDefaultIconName -> String)
-> ([GetChatFolderDefaultIconName] -> ShowS)
-> Show GetChatFolderDefaultIconName
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetChatFolderDefaultIconName -> ShowS
showsPrec :: Int -> GetChatFolderDefaultIconName -> ShowS
$cshow :: GetChatFolderDefaultIconName -> String
show :: GetChatFolderDefaultIconName -> String
$cshowList :: [GetChatFolderDefaultIconName] -> ShowS
showList :: [GetChatFolderDefaultIconName] -> ShowS
Show)

instance I.ShortShow GetChatFolderDefaultIconName where
  shortShow :: GetChatFolderDefaultIconName -> String
shortShow
    GetChatFolderDefaultIconName
      { folder :: GetChatFolderDefaultIconName -> Maybe ChatFolder
folder = Maybe ChatFolder
folder_
      }
        = String
"GetChatFolderDefaultIconName"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"folder" String -> Maybe ChatFolder -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatFolder
folder_
          ]

instance AT.ToJSON GetChatFolderDefaultIconName where
  toJSON :: GetChatFolderDefaultIconName -> Value
toJSON
    GetChatFolderDefaultIconName
      { folder :: GetChatFolderDefaultIconName -> Maybe ChatFolder
folder = Maybe ChatFolder
folder_
      }
        = [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
"getChatFolderDefaultIconName"
          , Key
"folder" Key -> Maybe ChatFolder -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe ChatFolder
folder_
          ]