module TD.Query.BoostChat
  (BoostChat(..)
  , defaultBoostChat
  ) where

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

-- | Boosts a chat and returns the list of available chat boost slots for the current user after the boost. Returns 'TD.Data.ChatBoostSlots.ChatBoostSlots'
data BoostChat
  = BoostChat
    { BoostChat -> Maybe Int
chat_id  :: Maybe Int   -- ^ Identifier of the chat
    , BoostChat -> Maybe [Int]
slot_ids :: Maybe [Int] -- ^ Identifiers of boost slots of the current user from which to apply boosts to the chat
    }
  deriving (BoostChat -> BoostChat -> Bool
(BoostChat -> BoostChat -> Bool)
-> (BoostChat -> BoostChat -> Bool) -> Eq BoostChat
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BoostChat -> BoostChat -> Bool
== :: BoostChat -> BoostChat -> Bool
$c/= :: BoostChat -> BoostChat -> Bool
/= :: BoostChat -> BoostChat -> Bool
Eq, Int -> BoostChat -> ShowS
[BoostChat] -> ShowS
BoostChat -> String
(Int -> BoostChat -> ShowS)
-> (BoostChat -> String)
-> ([BoostChat] -> ShowS)
-> Show BoostChat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BoostChat -> ShowS
showsPrec :: Int -> BoostChat -> ShowS
$cshow :: BoostChat -> String
show :: BoostChat -> String
$cshowList :: [BoostChat] -> ShowS
showList :: [BoostChat] -> ShowS
Show)

instance I.ShortShow BoostChat where
  shortShow :: BoostChat -> String
shortShow
    BoostChat
      { chat_id :: BoostChat -> Maybe Int
chat_id  = Maybe Int
chat_id_
      , slot_ids :: BoostChat -> Maybe [Int]
slot_ids = Maybe [Int]
slot_ids_
      }
        = String
"BoostChat"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"chat_id"  String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
          , String
"slot_ids" String -> Maybe [Int] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Int]
slot_ids_
          ]

instance AT.ToJSON BoostChat where
  toJSON :: BoostChat -> Value
toJSON
    BoostChat
      { chat_id :: BoostChat -> Maybe Int
chat_id  = Maybe Int
chat_id_
      , slot_ids :: BoostChat -> Maybe [Int]
slot_ids = Maybe [Int]
slot_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
"boostChat"
          , Key
"chat_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_id_
          , Key
"slot_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]
slot_ids_
          ]

defaultBoostChat :: BoostChat
defaultBoostChat :: BoostChat
defaultBoostChat =
  BoostChat
    { chat_id :: Maybe Int
chat_id  = Maybe Int
forall a. Maybe a
Nothing
    , slot_ids :: Maybe [Int]
slot_ids = Maybe [Int]
forall a. Maybe a
Nothing
    }