module TD.Query.ReportSupergroupAntiSpamFalsePositive
  (ReportSupergroupAntiSpamFalsePositive(..)
  , defaultReportSupergroupAntiSpamFalsePositive
  ) where

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

-- | Reports a false deletion of a message by aggressive anti-spam checks; requires administrator rights in the supergroup. Can be called only for messages from chatEventMessageDeleted with can_report_anti_spam_false_positive == true. Returns 'TD.Data.Ok.Ok'
data ReportSupergroupAntiSpamFalsePositive
  = ReportSupergroupAntiSpamFalsePositive
    { ReportSupergroupAntiSpamFalsePositive -> Maybe Int
supergroup_id :: Maybe Int -- ^ Supergroup identifier
    , ReportSupergroupAntiSpamFalsePositive -> Maybe Int
message_id    :: Maybe Int -- ^ Identifier of the erroneously deleted message from chatEventMessageDeleted
    }
  deriving (ReportSupergroupAntiSpamFalsePositive
-> ReportSupergroupAntiSpamFalsePositive -> Bool
(ReportSupergroupAntiSpamFalsePositive
 -> ReportSupergroupAntiSpamFalsePositive -> Bool)
-> (ReportSupergroupAntiSpamFalsePositive
    -> ReportSupergroupAntiSpamFalsePositive -> Bool)
-> Eq ReportSupergroupAntiSpamFalsePositive
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReportSupergroupAntiSpamFalsePositive
-> ReportSupergroupAntiSpamFalsePositive -> Bool
== :: ReportSupergroupAntiSpamFalsePositive
-> ReportSupergroupAntiSpamFalsePositive -> Bool
$c/= :: ReportSupergroupAntiSpamFalsePositive
-> ReportSupergroupAntiSpamFalsePositive -> Bool
/= :: ReportSupergroupAntiSpamFalsePositive
-> ReportSupergroupAntiSpamFalsePositive -> Bool
Eq, Int -> ReportSupergroupAntiSpamFalsePositive -> ShowS
[ReportSupergroupAntiSpamFalsePositive] -> ShowS
ReportSupergroupAntiSpamFalsePositive -> String
(Int -> ReportSupergroupAntiSpamFalsePositive -> ShowS)
-> (ReportSupergroupAntiSpamFalsePositive -> String)
-> ([ReportSupergroupAntiSpamFalsePositive] -> ShowS)
-> Show ReportSupergroupAntiSpamFalsePositive
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReportSupergroupAntiSpamFalsePositive -> ShowS
showsPrec :: Int -> ReportSupergroupAntiSpamFalsePositive -> ShowS
$cshow :: ReportSupergroupAntiSpamFalsePositive -> String
show :: ReportSupergroupAntiSpamFalsePositive -> String
$cshowList :: [ReportSupergroupAntiSpamFalsePositive] -> ShowS
showList :: [ReportSupergroupAntiSpamFalsePositive] -> ShowS
Show)

instance I.ShortShow ReportSupergroupAntiSpamFalsePositive where
  shortShow :: ReportSupergroupAntiSpamFalsePositive -> String
shortShow
    ReportSupergroupAntiSpamFalsePositive
      { supergroup_id :: ReportSupergroupAntiSpamFalsePositive -> Maybe Int
supergroup_id = Maybe Int
supergroup_id_
      , message_id :: ReportSupergroupAntiSpamFalsePositive -> Maybe Int
message_id    = Maybe Int
message_id_
      }
        = String
"ReportSupergroupAntiSpamFalsePositive"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"supergroup_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
supergroup_id_
          , String
"message_id"    String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_id_
          ]

instance AT.ToJSON ReportSupergroupAntiSpamFalsePositive where
  toJSON :: ReportSupergroupAntiSpamFalsePositive -> Value
toJSON
    ReportSupergroupAntiSpamFalsePositive
      { supergroup_id :: ReportSupergroupAntiSpamFalsePositive -> Maybe Int
supergroup_id = Maybe Int
supergroup_id_
      , message_id :: ReportSupergroupAntiSpamFalsePositive -> Maybe Int
message_id    = Maybe Int
message_id_
      }
        = [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
"reportSupergroupAntiSpamFalsePositive"
          , Key
"supergroup_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
supergroup_id_
          , Key
"message_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
message_id_
          ]

defaultReportSupergroupAntiSpamFalsePositive :: ReportSupergroupAntiSpamFalsePositive
defaultReportSupergroupAntiSpamFalsePositive :: ReportSupergroupAntiSpamFalsePositive
defaultReportSupergroupAntiSpamFalsePositive =
  ReportSupergroupAntiSpamFalsePositive
    { supergroup_id :: Maybe Int
supergroup_id = Maybe Int
forall a. Maybe a
Nothing
    , message_id :: Maybe Int
message_id    = Maybe Int
forall a. Maybe a
Nothing
    }