module TD.Query.SetGroupCallParticipantVolumeLevel
  (SetGroupCallParticipantVolumeLevel(..)
  , defaultSetGroupCallParticipantVolumeLevel
  ) 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

-- | Changes volume level of a participant of an active group call. If the current user can manage the group call, then the participant's volume level will be changed for all users with the default volume level. Returns 'TD.Data.Ok.Ok'
data SetGroupCallParticipantVolumeLevel
  = SetGroupCallParticipantVolumeLevel
    { SetGroupCallParticipantVolumeLevel -> Maybe Int
group_call_id  :: Maybe Int                         -- ^ Group call identifier
    , SetGroupCallParticipantVolumeLevel -> Maybe MessageSender
participant_id :: Maybe MessageSender.MessageSender -- ^ Participant identifier
    , SetGroupCallParticipantVolumeLevel -> Maybe Int
volume_level   :: Maybe Int                         -- ^ New participant's volume level; 1-20000 in hundreds of percents
    }
  deriving (SetGroupCallParticipantVolumeLevel
-> SetGroupCallParticipantVolumeLevel -> Bool
(SetGroupCallParticipantVolumeLevel
 -> SetGroupCallParticipantVolumeLevel -> Bool)
-> (SetGroupCallParticipantVolumeLevel
    -> SetGroupCallParticipantVolumeLevel -> Bool)
-> Eq SetGroupCallParticipantVolumeLevel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetGroupCallParticipantVolumeLevel
-> SetGroupCallParticipantVolumeLevel -> Bool
== :: SetGroupCallParticipantVolumeLevel
-> SetGroupCallParticipantVolumeLevel -> Bool
$c/= :: SetGroupCallParticipantVolumeLevel
-> SetGroupCallParticipantVolumeLevel -> Bool
/= :: SetGroupCallParticipantVolumeLevel
-> SetGroupCallParticipantVolumeLevel -> Bool
Eq, Int -> SetGroupCallParticipantVolumeLevel -> ShowS
[SetGroupCallParticipantVolumeLevel] -> ShowS
SetGroupCallParticipantVolumeLevel -> String
(Int -> SetGroupCallParticipantVolumeLevel -> ShowS)
-> (SetGroupCallParticipantVolumeLevel -> String)
-> ([SetGroupCallParticipantVolumeLevel] -> ShowS)
-> Show SetGroupCallParticipantVolumeLevel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetGroupCallParticipantVolumeLevel -> ShowS
showsPrec :: Int -> SetGroupCallParticipantVolumeLevel -> ShowS
$cshow :: SetGroupCallParticipantVolumeLevel -> String
show :: SetGroupCallParticipantVolumeLevel -> String
$cshowList :: [SetGroupCallParticipantVolumeLevel] -> ShowS
showList :: [SetGroupCallParticipantVolumeLevel] -> ShowS
Show)

instance I.ShortShow SetGroupCallParticipantVolumeLevel where
  shortShow :: SetGroupCallParticipantVolumeLevel -> String
shortShow
    SetGroupCallParticipantVolumeLevel
      { group_call_id :: SetGroupCallParticipantVolumeLevel -> Maybe Int
group_call_id  = Maybe Int
group_call_id_
      , participant_id :: SetGroupCallParticipantVolumeLevel -> Maybe MessageSender
participant_id = Maybe MessageSender
participant_id_
      , volume_level :: SetGroupCallParticipantVolumeLevel -> Maybe Int
volume_level   = Maybe Int
volume_level_
      }
        = String
"SetGroupCallParticipantVolumeLevel"
          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
"volume_level"   String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
volume_level_
          ]

instance AT.ToJSON SetGroupCallParticipantVolumeLevel where
  toJSON :: SetGroupCallParticipantVolumeLevel -> Value
toJSON
    SetGroupCallParticipantVolumeLevel
      { group_call_id :: SetGroupCallParticipantVolumeLevel -> Maybe Int
group_call_id  = Maybe Int
group_call_id_
      , participant_id :: SetGroupCallParticipantVolumeLevel -> Maybe MessageSender
participant_id = Maybe MessageSender
participant_id_
      , volume_level :: SetGroupCallParticipantVolumeLevel -> Maybe Int
volume_level   = Maybe Int
volume_level_
      }
        = [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
"setGroupCallParticipantVolumeLevel"
          , 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
"volume_level"   Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
volume_level_
          ]

defaultSetGroupCallParticipantVolumeLevel :: SetGroupCallParticipantVolumeLevel
defaultSetGroupCallParticipantVolumeLevel :: SetGroupCallParticipantVolumeLevel
defaultSetGroupCallParticipantVolumeLevel =
  SetGroupCallParticipantVolumeLevel
    { 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
    , volume_level :: Maybe Int
volume_level   = Maybe Int
forall a. Maybe a
Nothing
    }