module TD.Query.SetVideoChatTitle
  (SetVideoChatTitle(..)
  , defaultSetVideoChatTitle
  ) 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

-- | Sets title of a video chat; requires groupCall.can_be_managed right. Returns 'TD.Data.Ok.Ok'
data SetVideoChatTitle
  = SetVideoChatTitle
    { SetVideoChatTitle -> Maybe Int
group_call_id :: Maybe Int    -- ^ Group call identifier
    , SetVideoChatTitle -> Maybe Text
title         :: Maybe T.Text -- ^ New group call title; 1-64 characters
    }
  deriving (SetVideoChatTitle -> SetVideoChatTitle -> Bool
(SetVideoChatTitle -> SetVideoChatTitle -> Bool)
-> (SetVideoChatTitle -> SetVideoChatTitle -> Bool)
-> Eq SetVideoChatTitle
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetVideoChatTitle -> SetVideoChatTitle -> Bool
== :: SetVideoChatTitle -> SetVideoChatTitle -> Bool
$c/= :: SetVideoChatTitle -> SetVideoChatTitle -> Bool
/= :: SetVideoChatTitle -> SetVideoChatTitle -> Bool
Eq, Int -> SetVideoChatTitle -> ShowS
[SetVideoChatTitle] -> ShowS
SetVideoChatTitle -> String
(Int -> SetVideoChatTitle -> ShowS)
-> (SetVideoChatTitle -> String)
-> ([SetVideoChatTitle] -> ShowS)
-> Show SetVideoChatTitle
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetVideoChatTitle -> ShowS
showsPrec :: Int -> SetVideoChatTitle -> ShowS
$cshow :: SetVideoChatTitle -> String
show :: SetVideoChatTitle -> String
$cshowList :: [SetVideoChatTitle] -> ShowS
showList :: [SetVideoChatTitle] -> ShowS
Show)

instance I.ShortShow SetVideoChatTitle where
  shortShow :: SetVideoChatTitle -> String
shortShow
    SetVideoChatTitle
      { group_call_id :: SetVideoChatTitle -> Maybe Int
group_call_id = Maybe Int
group_call_id_
      , title :: SetVideoChatTitle -> Maybe Text
title         = Maybe Text
title_
      }
        = String
"SetVideoChatTitle"
          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_
          ]

instance AT.ToJSON SetVideoChatTitle where
  toJSON :: SetVideoChatTitle -> Value
toJSON
    SetVideoChatTitle
      { group_call_id :: SetVideoChatTitle -> Maybe Int
group_call_id = Maybe Int
group_call_id_
      , title :: SetVideoChatTitle -> Maybe Text
title         = Maybe Text
title_
      }
        = [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
"setVideoChatTitle"
          , 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_
          ]

defaultSetVideoChatTitle :: SetVideoChatTitle
defaultSetVideoChatTitle :: SetVideoChatTitle
defaultSetVideoChatTitle =
  SetVideoChatTitle
    { 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
    }