module TD.Query.StartGroupCallScreenSharing
  (StartGroupCallScreenSharing(..)
  , defaultStartGroupCallScreenSharing
  ) where

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

-- | Starts screen sharing in a joined group call. Returns join response payload for tgcalls. Returns 'TD.Data.Text.Text'
data StartGroupCallScreenSharing
  = StartGroupCallScreenSharing
    { StartGroupCallScreenSharing -> Maybe Int
group_call_id   :: Maybe Int    -- ^ Group call identifier
    , StartGroupCallScreenSharing -> Maybe Int
audio_source_id :: Maybe Int    -- ^ Screen sharing audio channel synchronization source identifier; received from tgcalls
    , StartGroupCallScreenSharing -> Maybe Text
payload         :: Maybe T.Text -- ^ Group call join payload; received from tgcalls
    }
  deriving (StartGroupCallScreenSharing -> StartGroupCallScreenSharing -> Bool
(StartGroupCallScreenSharing
 -> StartGroupCallScreenSharing -> Bool)
-> (StartGroupCallScreenSharing
    -> StartGroupCallScreenSharing -> Bool)
-> Eq StartGroupCallScreenSharing
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: StartGroupCallScreenSharing -> StartGroupCallScreenSharing -> Bool
== :: StartGroupCallScreenSharing -> StartGroupCallScreenSharing -> Bool
$c/= :: StartGroupCallScreenSharing -> StartGroupCallScreenSharing -> Bool
/= :: StartGroupCallScreenSharing -> StartGroupCallScreenSharing -> Bool
Eq, Int -> StartGroupCallScreenSharing -> ShowS
[StartGroupCallScreenSharing] -> ShowS
StartGroupCallScreenSharing -> String
(Int -> StartGroupCallScreenSharing -> ShowS)
-> (StartGroupCallScreenSharing -> String)
-> ([StartGroupCallScreenSharing] -> ShowS)
-> Show StartGroupCallScreenSharing
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> StartGroupCallScreenSharing -> ShowS
showsPrec :: Int -> StartGroupCallScreenSharing -> ShowS
$cshow :: StartGroupCallScreenSharing -> String
show :: StartGroupCallScreenSharing -> String
$cshowList :: [StartGroupCallScreenSharing] -> ShowS
showList :: [StartGroupCallScreenSharing] -> ShowS
Show)

instance I.ShortShow StartGroupCallScreenSharing where
  shortShow :: StartGroupCallScreenSharing -> String
shortShow
    StartGroupCallScreenSharing
      { group_call_id :: StartGroupCallScreenSharing -> Maybe Int
group_call_id   = Maybe Int
group_call_id_
      , audio_source_id :: StartGroupCallScreenSharing -> Maybe Int
audio_source_id = Maybe Int
audio_source_id_
      , payload :: StartGroupCallScreenSharing -> Maybe Text
payload         = Maybe Text
payload_
      }
        = String
"StartGroupCallScreenSharing"
          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
"audio_source_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
audio_source_id_
          , String
"payload"         String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
payload_
          ]

instance AT.ToJSON StartGroupCallScreenSharing where
  toJSON :: StartGroupCallScreenSharing -> Value
toJSON
    StartGroupCallScreenSharing
      { group_call_id :: StartGroupCallScreenSharing -> Maybe Int
group_call_id   = Maybe Int
group_call_id_
      , audio_source_id :: StartGroupCallScreenSharing -> Maybe Int
audio_source_id = Maybe Int
audio_source_id_
      , payload :: StartGroupCallScreenSharing -> Maybe Text
payload         = Maybe Text
payload_
      }
        = [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
"startGroupCallScreenSharing"
          , 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
"audio_source_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
audio_source_id_
          , Key
"payload"         Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
payload_
          ]

defaultStartGroupCallScreenSharing :: StartGroupCallScreenSharing
defaultStartGroupCallScreenSharing :: StartGroupCallScreenSharing
defaultStartGroupCallScreenSharing =
  StartGroupCallScreenSharing
    { group_call_id :: Maybe Int
group_call_id   = Maybe Int
forall a. Maybe a
Nothing
    , audio_source_id :: Maybe Int
audio_source_id = Maybe Int
forall a. Maybe a
Nothing
    , payload :: Maybe Text
payload         = Maybe Text
forall a. Maybe a
Nothing
    }