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
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SpanStatus -> SpanStatus -> Bool
$c/= :: SpanStatus -> SpanStatus -> Bool
== :: SpanStatus -> SpanStatus -> Bool
$c== :: SpanStatus -> SpanStatus -> Bool
Eq, Int -> SpanStatus -> ShowS
[SpanStatus] -> ShowS
SpanStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SpanStatus] -> ShowS
$cshowList :: [SpanStatus] -> ShowS
show :: SpanStatus -> String
$cshow :: SpanStatus -> String
showsPrec :: Int -> SpanStatus -> ShowS
$cshowsPrec :: Int -> SpanStatus -> ShowS
Show)

instance Aeson.ToJSON SpanStatus where
  toJSON :: SpanStatus -> Value
toJSON SpanStatus
spanStatus = forall a. ToJSON a => a -> Value
Aeson.toJSON 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"