module TD.Query.ProcessChatFolderNewChats
  (ProcessChatFolderNewChats(..)
  , defaultProcessChatFolderNewChats
  ) where

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

-- | Process new chats added to a shareable chat folder by its owner. Returns 'TD.Data.Ok.Ok'
data ProcessChatFolderNewChats
  = ProcessChatFolderNewChats
    { ProcessChatFolderNewChats -> Maybe Int
chat_folder_id :: Maybe Int   -- ^ Chat folder identifier
    , ProcessChatFolderNewChats -> Maybe [Int]
added_chat_ids :: Maybe [Int] -- ^ Identifiers of the new chats, which are added to the chat folder. The chats are automatically joined if they aren't joined yet
    }
  deriving (ProcessChatFolderNewChats -> ProcessChatFolderNewChats -> Bool
(ProcessChatFolderNewChats -> ProcessChatFolderNewChats -> Bool)
-> (ProcessChatFolderNewChats -> ProcessChatFolderNewChats -> Bool)
-> Eq ProcessChatFolderNewChats
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ProcessChatFolderNewChats -> ProcessChatFolderNewChats -> Bool
== :: ProcessChatFolderNewChats -> ProcessChatFolderNewChats -> Bool
$c/= :: ProcessChatFolderNewChats -> ProcessChatFolderNewChats -> Bool
/= :: ProcessChatFolderNewChats -> ProcessChatFolderNewChats -> Bool
Eq, Int -> ProcessChatFolderNewChats -> ShowS
[ProcessChatFolderNewChats] -> ShowS
ProcessChatFolderNewChats -> String
(Int -> ProcessChatFolderNewChats -> ShowS)
-> (ProcessChatFolderNewChats -> String)
-> ([ProcessChatFolderNewChats] -> ShowS)
-> Show ProcessChatFolderNewChats
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ProcessChatFolderNewChats -> ShowS
showsPrec :: Int -> ProcessChatFolderNewChats -> ShowS
$cshow :: ProcessChatFolderNewChats -> String
show :: ProcessChatFolderNewChats -> String
$cshowList :: [ProcessChatFolderNewChats] -> ShowS
showList :: [ProcessChatFolderNewChats] -> ShowS
Show)

instance I.ShortShow ProcessChatFolderNewChats where
  shortShow :: ProcessChatFolderNewChats -> String
shortShow
    ProcessChatFolderNewChats
      { chat_folder_id :: ProcessChatFolderNewChats -> Maybe Int
chat_folder_id = Maybe Int
chat_folder_id_
      , added_chat_ids :: ProcessChatFolderNewChats -> Maybe [Int]
added_chat_ids = Maybe [Int]
added_chat_ids_
      }
        = String
"ProcessChatFolderNewChats"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"chat_folder_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_folder_id_
          , String
"added_chat_ids" String -> Maybe [Int] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Int]
added_chat_ids_
          ]

instance AT.ToJSON ProcessChatFolderNewChats where
  toJSON :: ProcessChatFolderNewChats -> Value
toJSON
    ProcessChatFolderNewChats
      { chat_folder_id :: ProcessChatFolderNewChats -> Maybe Int
chat_folder_id = Maybe Int
chat_folder_id_
      , added_chat_ids :: ProcessChatFolderNewChats -> Maybe [Int]
added_chat_ids = Maybe [Int]
added_chat_ids_
      }
        = [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
"processChatFolderNewChats"
          , Key
"chat_folder_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
chat_folder_id_
          , Key
"added_chat_ids" Key -> Maybe [Int] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe [Int]
added_chat_ids_
          ]

defaultProcessChatFolderNewChats :: ProcessChatFolderNewChats
defaultProcessChatFolderNewChats :: ProcessChatFolderNewChats
defaultProcessChatFolderNewChats =
  ProcessChatFolderNewChats
    { chat_folder_id :: Maybe Int
chat_folder_id = Maybe Int
forall a. Maybe a
Nothing
    , added_chat_ids :: Maybe [Int]
added_chat_ids = Maybe [Int]
forall a. Maybe a
Nothing
    }