module TD.Query.GetVideoChatInviteLink
  (GetVideoChatInviteLink(..)
  , defaultGetVideoChatInviteLink
  ) where

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

-- | Returns invite link to a video chat in a public chat. Returns 'TD.Data.HttpUrl.HttpUrl'
data GetVideoChatInviteLink
  = GetVideoChatInviteLink
    { GetVideoChatInviteLink -> Maybe Int
group_call_id   :: Maybe Int  -- ^ Group call identifier
    , GetVideoChatInviteLink -> Maybe Bool
can_self_unmute :: Maybe Bool -- ^ Pass true if the invite link needs to contain an invite hash, passing which to joinVideoChat would allow the invited user to unmute themselves. Requires groupCall.can_be_managed right
    }
  deriving (GetVideoChatInviteLink -> GetVideoChatInviteLink -> Bool
(GetVideoChatInviteLink -> GetVideoChatInviteLink -> Bool)
-> (GetVideoChatInviteLink -> GetVideoChatInviteLink -> Bool)
-> Eq GetVideoChatInviteLink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetVideoChatInviteLink -> GetVideoChatInviteLink -> Bool
== :: GetVideoChatInviteLink -> GetVideoChatInviteLink -> Bool
$c/= :: GetVideoChatInviteLink -> GetVideoChatInviteLink -> Bool
/= :: GetVideoChatInviteLink -> GetVideoChatInviteLink -> Bool
Eq, Int -> GetVideoChatInviteLink -> ShowS
[GetVideoChatInviteLink] -> ShowS
GetVideoChatInviteLink -> String
(Int -> GetVideoChatInviteLink -> ShowS)
-> (GetVideoChatInviteLink -> String)
-> ([GetVideoChatInviteLink] -> ShowS)
-> Show GetVideoChatInviteLink
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetVideoChatInviteLink -> ShowS
showsPrec :: Int -> GetVideoChatInviteLink -> ShowS
$cshow :: GetVideoChatInviteLink -> String
show :: GetVideoChatInviteLink -> String
$cshowList :: [GetVideoChatInviteLink] -> ShowS
showList :: [GetVideoChatInviteLink] -> ShowS
Show)

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

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

defaultGetVideoChatInviteLink :: GetVideoChatInviteLink
defaultGetVideoChatInviteLink :: GetVideoChatInviteLink
defaultGetVideoChatInviteLink =
  GetVideoChatInviteLink
    { group_call_id :: Maybe Int
group_call_id   = Maybe Int
forall a. Maybe a
Nothing
    , can_self_unmute :: Maybe Bool
can_self_unmute = Maybe Bool
forall a. Maybe a
Nothing
    }