module TD.Query.StartGroupCallRecording
  (StartGroupCallRecording(..)
  , defaultStartGroupCallRecording
  ) 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 recording of an active group call. Requires groupCall.can_be_managed group call flag. Returns 'TD.Data.Ok.Ok'
data StartGroupCallRecording
  = StartGroupCallRecording
    { StartGroupCallRecording -> Maybe Int
group_call_id            :: Maybe Int    -- ^ Group call identifier
    , StartGroupCallRecording -> Maybe Text
title                    :: Maybe T.Text -- ^ Group call recording title; 0-64 characters
    , StartGroupCallRecording -> Maybe Bool
record_video             :: Maybe Bool   -- ^ Pass true to record a video file instead of an audio file
    , StartGroupCallRecording -> Maybe Bool
use_portrait_orientation :: Maybe Bool   -- ^ Pass true to use portrait orientation for video instead of landscape one
    }
  deriving (StartGroupCallRecording -> StartGroupCallRecording -> Bool
(StartGroupCallRecording -> StartGroupCallRecording -> Bool)
-> (StartGroupCallRecording -> StartGroupCallRecording -> Bool)
-> Eq StartGroupCallRecording
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: StartGroupCallRecording -> StartGroupCallRecording -> Bool
== :: StartGroupCallRecording -> StartGroupCallRecording -> Bool
$c/= :: StartGroupCallRecording -> StartGroupCallRecording -> Bool
/= :: StartGroupCallRecording -> StartGroupCallRecording -> Bool
Eq, Int -> StartGroupCallRecording -> ShowS
[StartGroupCallRecording] -> ShowS
StartGroupCallRecording -> String
(Int -> StartGroupCallRecording -> ShowS)
-> (StartGroupCallRecording -> String)
-> ([StartGroupCallRecording] -> ShowS)
-> Show StartGroupCallRecording
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> StartGroupCallRecording -> ShowS
showsPrec :: Int -> StartGroupCallRecording -> ShowS
$cshow :: StartGroupCallRecording -> String
show :: StartGroupCallRecording -> String
$cshowList :: [StartGroupCallRecording] -> ShowS
showList :: [StartGroupCallRecording] -> ShowS
Show)

instance I.ShortShow StartGroupCallRecording where
  shortShow :: StartGroupCallRecording -> String
shortShow
    StartGroupCallRecording
      { group_call_id :: StartGroupCallRecording -> Maybe Int
group_call_id            = Maybe Int
group_call_id_
      , title :: StartGroupCallRecording -> Maybe Text
title                    = Maybe Text
title_
      , record_video :: StartGroupCallRecording -> Maybe Bool
record_video             = Maybe Bool
record_video_
      , use_portrait_orientation :: StartGroupCallRecording -> Maybe Bool
use_portrait_orientation = Maybe Bool
use_portrait_orientation_
      }
        = String
"StartGroupCallRecording"
          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
"title"                    String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
title_
          , String
"record_video"             String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
record_video_
          , String
"use_portrait_orientation" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
use_portrait_orientation_
          ]

instance AT.ToJSON StartGroupCallRecording where
  toJSON :: StartGroupCallRecording -> Value
toJSON
    StartGroupCallRecording
      { group_call_id :: StartGroupCallRecording -> Maybe Int
group_call_id            = Maybe Int
group_call_id_
      , title :: StartGroupCallRecording -> Maybe Text
title                    = Maybe Text
title_
      , record_video :: StartGroupCallRecording -> Maybe Bool
record_video             = Maybe Bool
record_video_
      , use_portrait_orientation :: StartGroupCallRecording -> Maybe Bool
use_portrait_orientation = Maybe Bool
use_portrait_orientation_
      }
        = [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
"startGroupCallRecording"
          , 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
"title"                    Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
title_
          , Key
"record_video"             Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
record_video_
          , Key
"use_portrait_orientation" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
use_portrait_orientation_
          ]

defaultStartGroupCallRecording :: StartGroupCallRecording
defaultStartGroupCallRecording :: StartGroupCallRecording
defaultStartGroupCallRecording =
  StartGroupCallRecording
    { group_call_id :: Maybe Int
group_call_id            = Maybe Int
forall a. Maybe a
Nothing
    , title :: Maybe Text
title                    = Maybe Text
forall a. Maybe a
Nothing
    , record_video :: Maybe Bool
record_video             = Maybe Bool
forall a. Maybe a
Nothing
    , use_portrait_orientation :: Maybe Bool
use_portrait_orientation = Maybe Bool
forall a. Maybe a
Nothing
    }