module Patrol.Type.EventType where

import qualified Data.Aeson as Aeson

-- | <https://develop.sentry.dev/sdk/event-payloads/types/#eventtype>
data EventType
  = Csp
  | Default
  | Error
  | Expectct
  | Expectstaple
  | Hpkp
  | Transaction
  deriving (EventType -> EventType -> Bool
(EventType -> EventType -> Bool)
-> (EventType -> EventType -> Bool) -> Eq EventType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EventType -> EventType -> Bool
== :: EventType -> EventType -> Bool
$c/= :: EventType -> EventType -> Bool
/= :: EventType -> EventType -> Bool
Eq, Int -> EventType -> ShowS
[EventType] -> ShowS
EventType -> String
(Int -> EventType -> ShowS)
-> (EventType -> String)
-> ([EventType] -> ShowS)
-> Show EventType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EventType -> ShowS
showsPrec :: Int -> EventType -> ShowS
$cshow :: EventType -> String
show :: EventType -> String
$cshowList :: [EventType] -> ShowS
showList :: [EventType] -> ShowS
Show)

instance Aeson.ToJSON EventType where
  toJSON :: EventType -> Value
toJSON EventType
eventType = String -> Value
forall a. ToJSON a => a -> Value
Aeson.toJSON (String -> Value) -> String -> Value
forall a b. (a -> b) -> a -> b
$ case EventType
eventType of
    EventType
Csp -> String
"csp"
    EventType
Default -> String
"default"
    EventType
Error -> String
"error"
    EventType
Expectct -> String
"expectct"
    EventType
Expectstaple -> String
"expectstaple"
    EventType
Hpkp -> String
"hpkp"
    EventType
Transaction -> String
"transaction"