module TD.Query.ToggleVideoChatMuteNewParticipants
  (ToggleVideoChatMuteNewParticipants(..)
  , defaultToggleVideoChatMuteNewParticipants
  ) where

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

-- | Toggles whether new participants of a video chat can be unmuted only by administrators of the video chat. Requires groupCall.can_toggle_mute_new_participants right. Returns 'TD.Data.Ok.Ok'
data ToggleVideoChatMuteNewParticipants
  = ToggleVideoChatMuteNewParticipants
    { ToggleVideoChatMuteNewParticipants -> Maybe Int
group_call_id         :: Maybe Int  -- ^ Group call identifier
    , ToggleVideoChatMuteNewParticipants -> Maybe Bool
mute_new_participants :: Maybe Bool -- ^ New value of the mute_new_participants setting
    }
  deriving (ToggleVideoChatMuteNewParticipants
-> ToggleVideoChatMuteNewParticipants -> Bool
(ToggleVideoChatMuteNewParticipants
 -> ToggleVideoChatMuteNewParticipants -> Bool)
-> (ToggleVideoChatMuteNewParticipants
    -> ToggleVideoChatMuteNewParticipants -> Bool)
-> Eq ToggleVideoChatMuteNewParticipants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ToggleVideoChatMuteNewParticipants
-> ToggleVideoChatMuteNewParticipants -> Bool
== :: ToggleVideoChatMuteNewParticipants
-> ToggleVideoChatMuteNewParticipants -> Bool
$c/= :: ToggleVideoChatMuteNewParticipants
-> ToggleVideoChatMuteNewParticipants -> Bool
/= :: ToggleVideoChatMuteNewParticipants
-> ToggleVideoChatMuteNewParticipants -> Bool
Eq, Int -> ToggleVideoChatMuteNewParticipants -> ShowS
[ToggleVideoChatMuteNewParticipants] -> ShowS
ToggleVideoChatMuteNewParticipants -> String
(Int -> ToggleVideoChatMuteNewParticipants -> ShowS)
-> (ToggleVideoChatMuteNewParticipants -> String)
-> ([ToggleVideoChatMuteNewParticipants] -> ShowS)
-> Show ToggleVideoChatMuteNewParticipants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ToggleVideoChatMuteNewParticipants -> ShowS
showsPrec :: Int -> ToggleVideoChatMuteNewParticipants -> ShowS
$cshow :: ToggleVideoChatMuteNewParticipants -> String
show :: ToggleVideoChatMuteNewParticipants -> String
$cshowList :: [ToggleVideoChatMuteNewParticipants] -> ShowS
showList :: [ToggleVideoChatMuteNewParticipants] -> ShowS
Show)

instance I.ShortShow ToggleVideoChatMuteNewParticipants where
  shortShow :: ToggleVideoChatMuteNewParticipants -> String
shortShow
    ToggleVideoChatMuteNewParticipants
      { group_call_id :: ToggleVideoChatMuteNewParticipants -> Maybe Int
group_call_id         = Maybe Int
group_call_id_
      , mute_new_participants :: ToggleVideoChatMuteNewParticipants -> Maybe Bool
mute_new_participants = Maybe Bool
mute_new_participants_
      }
        = String
"ToggleVideoChatMuteNewParticipants"
          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
"mute_new_participants" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
mute_new_participants_
          ]

instance AT.ToJSON ToggleVideoChatMuteNewParticipants where
  toJSON :: ToggleVideoChatMuteNewParticipants -> Value
toJSON
    ToggleVideoChatMuteNewParticipants
      { group_call_id :: ToggleVideoChatMuteNewParticipants -> Maybe Int
group_call_id         = Maybe Int
group_call_id_
      , mute_new_participants :: ToggleVideoChatMuteNewParticipants -> Maybe Bool
mute_new_participants = Maybe Bool
mute_new_participants_
      }
        = [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
"toggleVideoChatMuteNewParticipants"
          , 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
"mute_new_participants" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
mute_new_participants_
          ]

defaultToggleVideoChatMuteNewParticipants :: ToggleVideoChatMuteNewParticipants
defaultToggleVideoChatMuteNewParticipants :: ToggleVideoChatMuteNewParticipants
defaultToggleVideoChatMuteNewParticipants =
  ToggleVideoChatMuteNewParticipants
    { group_call_id :: Maybe Int
group_call_id         = Maybe Int
forall a. Maybe a
Nothing
    , mute_new_participants :: Maybe Bool
mute_new_participants = Maybe Bool
forall a. Maybe a
Nothing
    }