module TD.Query.GetGroupCallInviteLink
  (GetGroupCallInviteLink(..)
  , defaultGetGroupCallInviteLink
  ) 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 GetGroupCallInviteLink
  = GetGroupCallInviteLink
    { GetGroupCallInviteLink -> Maybe Int
group_call_id   :: Maybe Int  -- ^ Group call identifier
    , GetGroupCallInviteLink -> Maybe Bool
can_self_unmute :: Maybe Bool -- ^ Pass true if the invite link needs to contain an invite hash, passing which to joinGroupCall would allow the invited user to unmute themselves. Requires groupCall.can_be_managed group call flag
    }
  deriving (GetGroupCallInviteLink -> GetGroupCallInviteLink -> Bool
(GetGroupCallInviteLink -> GetGroupCallInviteLink -> Bool)
-> (GetGroupCallInviteLink -> GetGroupCallInviteLink -> Bool)
-> Eq GetGroupCallInviteLink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetGroupCallInviteLink -> GetGroupCallInviteLink -> Bool
== :: GetGroupCallInviteLink -> GetGroupCallInviteLink -> Bool
$c/= :: GetGroupCallInviteLink -> GetGroupCallInviteLink -> Bool
/= :: GetGroupCallInviteLink -> GetGroupCallInviteLink -> Bool
Eq, Int -> GetGroupCallInviteLink -> ShowS
[GetGroupCallInviteLink] -> ShowS
GetGroupCallInviteLink -> String
(Int -> GetGroupCallInviteLink -> ShowS)
-> (GetGroupCallInviteLink -> String)
-> ([GetGroupCallInviteLink] -> ShowS)
-> Show GetGroupCallInviteLink
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetGroupCallInviteLink -> ShowS
showsPrec :: Int -> GetGroupCallInviteLink -> ShowS
$cshow :: GetGroupCallInviteLink -> String
show :: GetGroupCallInviteLink -> String
$cshowList :: [GetGroupCallInviteLink] -> ShowS
showList :: [GetGroupCallInviteLink] -> ShowS
Show)

instance I.ShortShow GetGroupCallInviteLink where
  shortShow :: GetGroupCallInviteLink -> String
shortShow
    GetGroupCallInviteLink
      { group_call_id :: GetGroupCallInviteLink -> Maybe Int
group_call_id   = Maybe Int
group_call_id_
      , can_self_unmute :: GetGroupCallInviteLink -> Maybe Bool
can_self_unmute = Maybe Bool
can_self_unmute_
      }
        = String
"GetGroupCallInviteLink"
          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 GetGroupCallInviteLink where
  toJSON :: GetGroupCallInviteLink -> Value
toJSON
    GetGroupCallInviteLink
      { group_call_id :: GetGroupCallInviteLink -> Maybe Int
group_call_id   = Maybe Int
group_call_id_
      , can_self_unmute :: GetGroupCallInviteLink -> 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
"getGroupCallInviteLink"
          , 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_
          ]

defaultGetGroupCallInviteLink :: GetGroupCallInviteLink
defaultGetGroupCallInviteLink :: GetGroupCallInviteLink
defaultGetGroupCallInviteLink =
  GetGroupCallInviteLink
    { 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
    }