module TD.Query.ToggleGroupCallMuteNewParticipants
  (ToggleGroupCallMuteNewParticipants(..)
  , defaultToggleGroupCallMuteNewParticipants
  ) 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 group call can be unmuted only by administrators of the group call. Requires groupCall.can_toggle_mute_new_participants group call flag. Returns 'TD.Data.Ok.Ok'
data ToggleGroupCallMuteNewParticipants
  = ToggleGroupCallMuteNewParticipants
    { ToggleGroupCallMuteNewParticipants -> Maybe Int
group_call_id         :: Maybe Int  -- ^ Group call identifier
    , ToggleGroupCallMuteNewParticipants -> Maybe Bool
mute_new_participants :: Maybe Bool -- ^ New value of the mute_new_participants setting
    }
  deriving (ToggleGroupCallMuteNewParticipants
-> ToggleGroupCallMuteNewParticipants -> Bool
(ToggleGroupCallMuteNewParticipants
 -> ToggleGroupCallMuteNewParticipants -> Bool)
-> (ToggleGroupCallMuteNewParticipants
    -> ToggleGroupCallMuteNewParticipants -> Bool)
-> Eq ToggleGroupCallMuteNewParticipants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ToggleGroupCallMuteNewParticipants
-> ToggleGroupCallMuteNewParticipants -> Bool
== :: ToggleGroupCallMuteNewParticipants
-> ToggleGroupCallMuteNewParticipants -> Bool
$c/= :: ToggleGroupCallMuteNewParticipants
-> ToggleGroupCallMuteNewParticipants -> Bool
/= :: ToggleGroupCallMuteNewParticipants
-> ToggleGroupCallMuteNewParticipants -> Bool
Eq, Int -> ToggleGroupCallMuteNewParticipants -> ShowS
[ToggleGroupCallMuteNewParticipants] -> ShowS
ToggleGroupCallMuteNewParticipants -> String
(Int -> ToggleGroupCallMuteNewParticipants -> ShowS)
-> (ToggleGroupCallMuteNewParticipants -> String)
-> ([ToggleGroupCallMuteNewParticipants] -> ShowS)
-> Show ToggleGroupCallMuteNewParticipants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ToggleGroupCallMuteNewParticipants -> ShowS
showsPrec :: Int -> ToggleGroupCallMuteNewParticipants -> ShowS
$cshow :: ToggleGroupCallMuteNewParticipants -> String
show :: ToggleGroupCallMuteNewParticipants -> String
$cshowList :: [ToggleGroupCallMuteNewParticipants] -> ShowS
showList :: [ToggleGroupCallMuteNewParticipants] -> ShowS
Show)

instance I.ShortShow ToggleGroupCallMuteNewParticipants where
  shortShow :: ToggleGroupCallMuteNewParticipants -> String
shortShow
    ToggleGroupCallMuteNewParticipants
      { group_call_id :: ToggleGroupCallMuteNewParticipants -> Maybe Int
group_call_id         = Maybe Int
group_call_id_
      , mute_new_participants :: ToggleGroupCallMuteNewParticipants -> Maybe Bool
mute_new_participants = Maybe Bool
mute_new_participants_
      }
        = String
"ToggleGroupCallMuteNewParticipants"
          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 ToggleGroupCallMuteNewParticipants where
  toJSON :: ToggleGroupCallMuteNewParticipants -> Value
toJSON
    ToggleGroupCallMuteNewParticipants
      { group_call_id :: ToggleGroupCallMuteNewParticipants -> Maybe Int
group_call_id         = Maybe Int
group_call_id_
      , mute_new_participants :: ToggleGroupCallMuteNewParticipants -> 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
"toggleGroupCallMuteNewParticipants"
          , 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_
          ]

defaultToggleGroupCallMuteNewParticipants :: ToggleGroupCallMuteNewParticipants
defaultToggleGroupCallMuteNewParticipants :: ToggleGroupCallMuteNewParticipants
defaultToggleGroupCallMuteNewParticipants =
  ToggleGroupCallMuteNewParticipants
    { 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
    }