module Patrol.Type.SpanStatus where

import qualified Data.Aeson as Aeson

-- | <https://develop.sentry.dev/sdk/event-payloads/types/#spanstatus>
data SpanStatus
  = Aborted
  | AlreadyExists
  | Cancelled
  | DataLoss
  | DeadlineExceeded
  | FailedPrecondition
  | InternalError
  | InvalidArgument
  | NotFound
  | Ok
  | OutOfRange
  | PermissionDenied
  | ResourceExhausted
  | Unauthenticated
  | Unavailable
  | Unimplemented
  | Unknown
  deriving (SpanStatus -> SpanStatus -> Bool
(SpanStatus -> SpanStatus -> Bool)
-> (SpanStatus -> SpanStatus -> Bool) -> Eq SpanStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SpanStatus -> SpanStatus -> Bool
== :: SpanStatus -> SpanStatus -> Bool
$c/= :: SpanStatus -> SpanStatus -> Bool
/= :: SpanStatus -> SpanStatus -> Bool
Eq, Int -> SpanStatus -> ShowS
[SpanStatus] -> ShowS
SpanStatus -> String
(Int -> SpanStatus -> ShowS)
-> (SpanStatus -> String)
-> ([SpanStatus] -> ShowS)
-> Show SpanStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SpanStatus -> ShowS
showsPrec :: Int -> SpanStatus -> ShowS
$cshow :: SpanStatus -> String
show :: SpanStatus -> String
$cshowList :: [SpanStatus] -> ShowS
showList :: [SpanStatus] -> ShowS
Show)

instance Aeson.ToJSON SpanStatus where
  toJSON :: SpanStatus -> Value
toJSON SpanStatus
spanStatus = String -> Value
forall a. ToJSON a => a -> Value
Aeson.toJSON (String -> Value) -> String -> Value
forall a b. (a -> b) -> a -> b
$ case SpanStatus
spanStatus of
    SpanStatus
Aborted -> String
"aborted"
    SpanStatus
AlreadyExists -> String
"already_exists"
    SpanStatus
Cancelled -> String
"cancelled"
    SpanStatus
DataLoss -> String
"data_loss"
    SpanStatus
DeadlineExceeded -> String
"deadline_exceeded"
    SpanStatus
FailedPrecondition -> String
"failed_precondition"
    SpanStatus
InternalError -> String
"internal_error"
    SpanStatus
InvalidArgument -> String
"invalid_argument"
    SpanStatus
NotFound -> String
"not_found"
    SpanStatus
Ok -> String
"ok"
    SpanStatus
OutOfRange -> String
"out_of_range"
    SpanStatus
PermissionDenied -> String
"permission_denied"
    SpanStatus
ResourceExhausted -> String
"resource_exhausted"
    SpanStatus
Unauthenticated -> String
"unauthenticated"
    SpanStatus
Unavailable -> String
"unavailable"
    SpanStatus
Unimplemented -> String
"unimplemented"
    SpanStatus
Unknown -> String
"unknown"