module TD.Query.SetUserSupportInfo
  (SetUserSupportInfo(..)
  , defaultSetUserSupportInfo
  ) where

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

-- | Sets support information for the given user; for Telegram support only. Returns 'TD.Data.UserSupportInfo.UserSupportInfo'
data SetUserSupportInfo
  = SetUserSupportInfo
    { SetUserSupportInfo -> Maybe Int
user_id :: Maybe Int                         -- ^ User identifier
    , SetUserSupportInfo -> Maybe FormattedText
message :: Maybe FormattedText.FormattedText -- ^ New information message
    }
  deriving (SetUserSupportInfo -> SetUserSupportInfo -> Bool
(SetUserSupportInfo -> SetUserSupportInfo -> Bool)
-> (SetUserSupportInfo -> SetUserSupportInfo -> Bool)
-> Eq SetUserSupportInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetUserSupportInfo -> SetUserSupportInfo -> Bool
== :: SetUserSupportInfo -> SetUserSupportInfo -> Bool
$c/= :: SetUserSupportInfo -> SetUserSupportInfo -> Bool
/= :: SetUserSupportInfo -> SetUserSupportInfo -> Bool
Eq, Int -> SetUserSupportInfo -> ShowS
[SetUserSupportInfo] -> ShowS
SetUserSupportInfo -> String
(Int -> SetUserSupportInfo -> ShowS)
-> (SetUserSupportInfo -> String)
-> ([SetUserSupportInfo] -> ShowS)
-> Show SetUserSupportInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetUserSupportInfo -> ShowS
showsPrec :: Int -> SetUserSupportInfo -> ShowS
$cshow :: SetUserSupportInfo -> String
show :: SetUserSupportInfo -> String
$cshowList :: [SetUserSupportInfo] -> ShowS
showList :: [SetUserSupportInfo] -> ShowS
Show)

instance I.ShortShow SetUserSupportInfo where
  shortShow :: SetUserSupportInfo -> String
shortShow
    SetUserSupportInfo
      { user_id :: SetUserSupportInfo -> Maybe Int
user_id = Maybe Int
user_id_
      , message :: SetUserSupportInfo -> Maybe FormattedText
message = Maybe FormattedText
message_
      }
        = String
"SetUserSupportInfo"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
          , String
"message" String -> Maybe FormattedText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe FormattedText
message_
          ]

instance AT.ToJSON SetUserSupportInfo where
  toJSON :: SetUserSupportInfo -> Value
toJSON
    SetUserSupportInfo
      { user_id :: SetUserSupportInfo -> Maybe Int
user_id = Maybe Int
user_id_
      , message :: SetUserSupportInfo -> Maybe FormattedText
message = Maybe FormattedText
message_
      }
        = [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
"setUserSupportInfo"
          , Key
"user_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
user_id_
          , Key
"message" Key -> Maybe FormattedText -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe FormattedText
message_
          ]

defaultSetUserSupportInfo :: SetUserSupportInfo
defaultSetUserSupportInfo :: SetUserSupportInfo
defaultSetUserSupportInfo =
  SetUserSupportInfo
    { user_id :: Maybe Int
user_id = Maybe Int
forall a. Maybe a
Nothing
    , message :: Maybe FormattedText
message = Maybe FormattedText
forall a. Maybe a
Nothing
    }