module TD.Query.SetGroupCallTitle
  (SetGroupCallTitle(..)
  , defaultSetGroupCallTitle
  ) 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 group call title. Requires groupCall.can_be_managed group call flag. Returns 'TD.Data.Ok.Ok'
data SetGroupCallTitle
  = SetGroupCallTitle
    { SetGroupCallTitle -> Maybe Int
group_call_id :: Maybe Int    -- ^ Group call identifier
    , SetGroupCallTitle -> Maybe Text
title         :: Maybe T.Text -- ^ New group call title; 1-64 characters
    }
  deriving (SetGroupCallTitle -> SetGroupCallTitle -> Bool
(SetGroupCallTitle -> SetGroupCallTitle -> Bool)
-> (SetGroupCallTitle -> SetGroupCallTitle -> Bool)
-> Eq SetGroupCallTitle
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetGroupCallTitle -> SetGroupCallTitle -> Bool
== :: SetGroupCallTitle -> SetGroupCallTitle -> Bool
$c/= :: SetGroupCallTitle -> SetGroupCallTitle -> Bool
/= :: SetGroupCallTitle -> SetGroupCallTitle -> Bool
Eq, Int -> SetGroupCallTitle -> ShowS
[SetGroupCallTitle] -> ShowS
SetGroupCallTitle -> String
(Int -> SetGroupCallTitle -> ShowS)
-> (SetGroupCallTitle -> String)
-> ([SetGroupCallTitle] -> ShowS)
-> Show SetGroupCallTitle
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetGroupCallTitle -> ShowS
showsPrec :: Int -> SetGroupCallTitle -> ShowS
$cshow :: SetGroupCallTitle -> String
show :: SetGroupCallTitle -> String
$cshowList :: [SetGroupCallTitle] -> ShowS
showList :: [SetGroupCallTitle] -> ShowS
Show)

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

defaultSetGroupCallTitle :: SetGroupCallTitle
defaultSetGroupCallTitle :: SetGroupCallTitle
defaultSetGroupCallTitle =
  SetGroupCallTitle
    { 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
    }