module TD.Query.ToggleGroupCallParticipantIsMuted
  (ToggleGroupCallParticipantIsMuted(..)
  , defaultToggleGroupCallParticipantIsMuted
  ) 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.MessageSender as MessageSender

-- | Toggles whether a participant of an active group call is muted, unmuted, or allowed to unmute themselves. Returns 'TD.Data.Ok.Ok'
data ToggleGroupCallParticipantIsMuted
  = ToggleGroupCallParticipantIsMuted
    { ToggleGroupCallParticipantIsMuted -> Maybe Int
group_call_id  :: Maybe Int                         -- ^ Group call identifier
    , ToggleGroupCallParticipantIsMuted -> Maybe MessageSender
participant_id :: Maybe MessageSender.MessageSender -- ^ Participant identifier
    , ToggleGroupCallParticipantIsMuted -> Maybe Bool
is_muted       :: Maybe Bool                        -- ^ Pass true to mute the user; pass false to unmute them
    }
  deriving (ToggleGroupCallParticipantIsMuted
-> ToggleGroupCallParticipantIsMuted -> Bool
(ToggleGroupCallParticipantIsMuted
 -> ToggleGroupCallParticipantIsMuted -> Bool)
-> (ToggleGroupCallParticipantIsMuted
    -> ToggleGroupCallParticipantIsMuted -> Bool)
-> Eq ToggleGroupCallParticipantIsMuted
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ToggleGroupCallParticipantIsMuted
-> ToggleGroupCallParticipantIsMuted -> Bool
== :: ToggleGroupCallParticipantIsMuted
-> ToggleGroupCallParticipantIsMuted -> Bool
$c/= :: ToggleGroupCallParticipantIsMuted
-> ToggleGroupCallParticipantIsMuted -> Bool
/= :: ToggleGroupCallParticipantIsMuted
-> ToggleGroupCallParticipantIsMuted -> Bool
Eq, Int -> ToggleGroupCallParticipantIsMuted -> ShowS
[ToggleGroupCallParticipantIsMuted] -> ShowS
ToggleGroupCallParticipantIsMuted -> String
(Int -> ToggleGroupCallParticipantIsMuted -> ShowS)
-> (ToggleGroupCallParticipantIsMuted -> String)
-> ([ToggleGroupCallParticipantIsMuted] -> ShowS)
-> Show ToggleGroupCallParticipantIsMuted
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ToggleGroupCallParticipantIsMuted -> ShowS
showsPrec :: Int -> ToggleGroupCallParticipantIsMuted -> ShowS
$cshow :: ToggleGroupCallParticipantIsMuted -> String
show :: ToggleGroupCallParticipantIsMuted -> String
$cshowList :: [ToggleGroupCallParticipantIsMuted] -> ShowS
showList :: [ToggleGroupCallParticipantIsMuted] -> ShowS
Show)

instance I.ShortShow ToggleGroupCallParticipantIsMuted where
  shortShow :: ToggleGroupCallParticipantIsMuted -> String
shortShow
    ToggleGroupCallParticipantIsMuted
      { group_call_id :: ToggleGroupCallParticipantIsMuted -> Maybe Int
group_call_id  = Maybe Int
group_call_id_
      , participant_id :: ToggleGroupCallParticipantIsMuted -> Maybe MessageSender
participant_id = Maybe MessageSender
participant_id_
      , is_muted :: ToggleGroupCallParticipantIsMuted -> Maybe Bool
is_muted       = Maybe Bool
is_muted_
      }
        = String
"ToggleGroupCallParticipantIsMuted"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"group_call_id"  String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
group_call_id_
          , String
"participant_id" String -> Maybe MessageSender -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe MessageSender
participant_id_
          , String
"is_muted"       String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
is_muted_
          ]

instance AT.ToJSON ToggleGroupCallParticipantIsMuted where
  toJSON :: ToggleGroupCallParticipantIsMuted -> Value
toJSON
    ToggleGroupCallParticipantIsMuted
      { group_call_id :: ToggleGroupCallParticipantIsMuted -> Maybe Int
group_call_id  = Maybe Int
group_call_id_
      , participant_id :: ToggleGroupCallParticipantIsMuted -> Maybe MessageSender
participant_id = Maybe MessageSender
participant_id_
      , is_muted :: ToggleGroupCallParticipantIsMuted -> Maybe Bool
is_muted       = Maybe Bool
is_muted_
      }
        = [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
"toggleGroupCallParticipantIsMuted"
          , Key
"group_call_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
group_call_id_
          , Key
"participant_id" Key -> Maybe MessageSender -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe MessageSender
participant_id_
          , Key
"is_muted"       Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
is_muted_
          ]

defaultToggleGroupCallParticipantIsMuted :: ToggleGroupCallParticipantIsMuted
defaultToggleGroupCallParticipantIsMuted :: ToggleGroupCallParticipantIsMuted
defaultToggleGroupCallParticipantIsMuted =
  ToggleGroupCallParticipantIsMuted
    { group_call_id :: Maybe Int
group_call_id  = Maybe Int
forall a. Maybe a
Nothing
    , participant_id :: Maybe MessageSender
participant_id = Maybe MessageSender
forall a. Maybe a
Nothing
    , is_muted :: Maybe Bool
is_muted       = Maybe Bool
forall a. Maybe a
Nothing
    }