{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StrictData #-}
module Convex.TestingInterface.Trace (
TestRunTrace (..),
TestCategory (..),
IterationTrace (..),
IterationStatus (..),
Transition (..),
TransitionResult (..),
TxSummary (..),
TxInputSummary (..),
TxOutputSummary (..),
ValueSummary (..),
AssetSummary (..),
ThreatModelTrace (..),
ThreatModelTraceOutcome (..),
) where
import Data.Aeson (ToJSON (..), Value, object, (.=))
import Data.Text (Text)
import GHC.Generics (Generic)
data TestRunTrace = TestRunTrace
{ TestRunTrace -> Int
trtTestId :: !Int
, TestRunTrace -> Text
trtTestName :: !Text
, TestRunTrace -> [Text]
trtPath :: ![Text]
, TestRunTrace -> TestCategory
trtCategory :: !TestCategory
, TestRunTrace -> [IterationTrace]
trtIterations :: ![IterationTrace]
}
deriving (TestRunTrace -> TestRunTrace -> Bool
(TestRunTrace -> TestRunTrace -> Bool)
-> (TestRunTrace -> TestRunTrace -> Bool) -> Eq TestRunTrace
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TestRunTrace -> TestRunTrace -> Bool
== :: TestRunTrace -> TestRunTrace -> Bool
$c/= :: TestRunTrace -> TestRunTrace -> Bool
/= :: TestRunTrace -> TestRunTrace -> Bool
Eq, Int -> TestRunTrace -> ShowS
[TestRunTrace] -> ShowS
TestRunTrace -> String
(Int -> TestRunTrace -> ShowS)
-> (TestRunTrace -> String)
-> ([TestRunTrace] -> ShowS)
-> Show TestRunTrace
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TestRunTrace -> ShowS
showsPrec :: Int -> TestRunTrace -> ShowS
$cshow :: TestRunTrace -> String
show :: TestRunTrace -> String
$cshowList :: [TestRunTrace] -> ShowS
showList :: [TestRunTrace] -> ShowS
Show, (forall x. TestRunTrace -> Rep TestRunTrace x)
-> (forall x. Rep TestRunTrace x -> TestRunTrace)
-> Generic TestRunTrace
forall x. Rep TestRunTrace x -> TestRunTrace
forall x. TestRunTrace -> Rep TestRunTrace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TestRunTrace -> Rep TestRunTrace x
from :: forall x. TestRunTrace -> Rep TestRunTrace x
$cto :: forall x. Rep TestRunTrace x -> TestRunTrace
to :: forall x. Rep TestRunTrace x -> TestRunTrace
Generic)
data TestCategory
= Positive
| Negative
deriving (TestCategory -> TestCategory -> Bool
(TestCategory -> TestCategory -> Bool)
-> (TestCategory -> TestCategory -> Bool) -> Eq TestCategory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TestCategory -> TestCategory -> Bool
== :: TestCategory -> TestCategory -> Bool
$c/= :: TestCategory -> TestCategory -> Bool
/= :: TestCategory -> TestCategory -> Bool
Eq, Int -> TestCategory -> ShowS
[TestCategory] -> ShowS
TestCategory -> String
(Int -> TestCategory -> ShowS)
-> (TestCategory -> String)
-> ([TestCategory] -> ShowS)
-> Show TestCategory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TestCategory -> ShowS
showsPrec :: Int -> TestCategory -> ShowS
$cshow :: TestCategory -> String
show :: TestCategory -> String
$cshowList :: [TestCategory] -> ShowS
showList :: [TestCategory] -> ShowS
Show, (forall x. TestCategory -> Rep TestCategory x)
-> (forall x. Rep TestCategory x -> TestCategory)
-> Generic TestCategory
forall x. Rep TestCategory x -> TestCategory
forall x. TestCategory -> Rep TestCategory x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TestCategory -> Rep TestCategory x
from :: forall x. TestCategory -> Rep TestCategory x
$cto :: forall x. Rep TestCategory x -> TestCategory
to :: forall x. Rep TestCategory x -> TestCategory
Generic)
instance ToJSON TestCategory where
toJSON :: TestCategory -> Value
toJSON TestCategory
Positive = Value
"positive"
toJSON TestCategory
Negative = Value
"negative"
data IterationTrace = IterationTrace
{ IterationTrace -> Int
itIndex :: !Int
, IterationTrace -> IterationStatus
itStatus :: !IterationStatus
, IterationTrace -> [Transition]
itTransitions :: ![Transition]
, IterationTrace -> [ThreatModelTrace]
itThreatModels :: ![ThreatModelTrace]
}
deriving (IterationTrace -> IterationTrace -> Bool
(IterationTrace -> IterationTrace -> Bool)
-> (IterationTrace -> IterationTrace -> Bool) -> Eq IterationTrace
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: IterationTrace -> IterationTrace -> Bool
== :: IterationTrace -> IterationTrace -> Bool
$c/= :: IterationTrace -> IterationTrace -> Bool
/= :: IterationTrace -> IterationTrace -> Bool
Eq, Int -> IterationTrace -> ShowS
[IterationTrace] -> ShowS
IterationTrace -> String
(Int -> IterationTrace -> ShowS)
-> (IterationTrace -> String)
-> ([IterationTrace] -> ShowS)
-> Show IterationTrace
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> IterationTrace -> ShowS
showsPrec :: Int -> IterationTrace -> ShowS
$cshow :: IterationTrace -> String
show :: IterationTrace -> String
$cshowList :: [IterationTrace] -> ShowS
showList :: [IterationTrace] -> ShowS
Show, (forall x. IterationTrace -> Rep IterationTrace x)
-> (forall x. Rep IterationTrace x -> IterationTrace)
-> Generic IterationTrace
forall x. Rep IterationTrace x -> IterationTrace
forall x. IterationTrace -> Rep IterationTrace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. IterationTrace -> Rep IterationTrace x
from :: forall x. IterationTrace -> Rep IterationTrace x
$cto :: forall x. Rep IterationTrace x -> IterationTrace
to :: forall x. Rep IterationTrace x -> IterationTrace
Generic)
data IterationStatus
= IterationSuccess
| IterationFailure !Text
| IterationDiscarded !Text
deriving (IterationStatus -> IterationStatus -> Bool
(IterationStatus -> IterationStatus -> Bool)
-> (IterationStatus -> IterationStatus -> Bool)
-> Eq IterationStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: IterationStatus -> IterationStatus -> Bool
== :: IterationStatus -> IterationStatus -> Bool
$c/= :: IterationStatus -> IterationStatus -> Bool
/= :: IterationStatus -> IterationStatus -> Bool
Eq, Int -> IterationStatus -> ShowS
[IterationStatus] -> ShowS
IterationStatus -> String
(Int -> IterationStatus -> ShowS)
-> (IterationStatus -> String)
-> ([IterationStatus] -> ShowS)
-> Show IterationStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> IterationStatus -> ShowS
showsPrec :: Int -> IterationStatus -> ShowS
$cshow :: IterationStatus -> String
show :: IterationStatus -> String
$cshowList :: [IterationStatus] -> ShowS
showList :: [IterationStatus] -> ShowS
Show, (forall x. IterationStatus -> Rep IterationStatus x)
-> (forall x. Rep IterationStatus x -> IterationStatus)
-> Generic IterationStatus
forall x. Rep IterationStatus x -> IterationStatus
forall x. IterationStatus -> Rep IterationStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. IterationStatus -> Rep IterationStatus x
from :: forall x. IterationStatus -> Rep IterationStatus x
$cto :: forall x. Rep IterationStatus x -> IterationStatus
to :: forall x. Rep IterationStatus x -> IterationStatus
Generic)
data Transition = Transition
{ Transition -> Int
trStepIndex :: !Int
, Transition -> Text
trAction :: !Text
, Transition -> Value
trStateBefore :: !Value
, Transition -> Value
trStateAfter :: !Value
, Transition -> Maybe TxSummary
trTransaction :: !(Maybe TxSummary)
, Transition -> TransitionResult
trResult :: !TransitionResult
}
deriving (Transition -> Transition -> Bool
(Transition -> Transition -> Bool)
-> (Transition -> Transition -> Bool) -> Eq Transition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Transition -> Transition -> Bool
== :: Transition -> Transition -> Bool
$c/= :: Transition -> Transition -> Bool
/= :: Transition -> Transition -> Bool
Eq, Int -> Transition -> ShowS
[Transition] -> ShowS
Transition -> String
(Int -> Transition -> ShowS)
-> (Transition -> String)
-> ([Transition] -> ShowS)
-> Show Transition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Transition -> ShowS
showsPrec :: Int -> Transition -> ShowS
$cshow :: Transition -> String
show :: Transition -> String
$cshowList :: [Transition] -> ShowS
showList :: [Transition] -> ShowS
Show, (forall x. Transition -> Rep Transition x)
-> (forall x. Rep Transition x -> Transition) -> Generic Transition
forall x. Rep Transition x -> Transition
forall x. Transition -> Rep Transition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Transition -> Rep Transition x
from :: forall x. Transition -> Rep Transition x
$cto :: forall x. Rep Transition x -> Transition
to :: forall x. Rep Transition x -> Transition
Generic)
data TransitionResult
=
TransitionSuccess !Text
|
TransitionFailure !Text
deriving (TransitionResult -> TransitionResult -> Bool
(TransitionResult -> TransitionResult -> Bool)
-> (TransitionResult -> TransitionResult -> Bool)
-> Eq TransitionResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TransitionResult -> TransitionResult -> Bool
== :: TransitionResult -> TransitionResult -> Bool
$c/= :: TransitionResult -> TransitionResult -> Bool
/= :: TransitionResult -> TransitionResult -> Bool
Eq, Int -> TransitionResult -> ShowS
[TransitionResult] -> ShowS
TransitionResult -> String
(Int -> TransitionResult -> ShowS)
-> (TransitionResult -> String)
-> ([TransitionResult] -> ShowS)
-> Show TransitionResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TransitionResult -> ShowS
showsPrec :: Int -> TransitionResult -> ShowS
$cshow :: TransitionResult -> String
show :: TransitionResult -> String
$cshowList :: [TransitionResult] -> ShowS
showList :: [TransitionResult] -> ShowS
Show, (forall x. TransitionResult -> Rep TransitionResult x)
-> (forall x. Rep TransitionResult x -> TransitionResult)
-> Generic TransitionResult
forall x. Rep TransitionResult x -> TransitionResult
forall x. TransitionResult -> Rep TransitionResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TransitionResult -> Rep TransitionResult x
from :: forall x. TransitionResult -> Rep TransitionResult x
$cto :: forall x. Rep TransitionResult x -> TransitionResult
to :: forall x. Rep TransitionResult x -> TransitionResult
Generic)
data TxSummary = TxSummary
{ TxSummary -> Maybe Text
txsId :: !(Maybe Text)
, TxSummary -> [TxInputSummary]
txsInputs :: ![TxInputSummary]
, TxSummary -> [TxOutputSummary]
txsOutputs :: ![TxOutputSummary]
, TxSummary -> Maybe ValueSummary
txsMint :: !(Maybe ValueSummary)
, TxSummary -> Integer
txsFee :: !Integer
, TxSummary -> [Text]
txsSigners :: ![Text]
, TxSummary -> Maybe Text
txsValidRange :: !(Maybe Text)
}
deriving (TxSummary -> TxSummary -> Bool
(TxSummary -> TxSummary -> Bool)
-> (TxSummary -> TxSummary -> Bool) -> Eq TxSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TxSummary -> TxSummary -> Bool
== :: TxSummary -> TxSummary -> Bool
$c/= :: TxSummary -> TxSummary -> Bool
/= :: TxSummary -> TxSummary -> Bool
Eq, Int -> TxSummary -> ShowS
[TxSummary] -> ShowS
TxSummary -> String
(Int -> TxSummary -> ShowS)
-> (TxSummary -> String)
-> ([TxSummary] -> ShowS)
-> Show TxSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TxSummary -> ShowS
showsPrec :: Int -> TxSummary -> ShowS
$cshow :: TxSummary -> String
show :: TxSummary -> String
$cshowList :: [TxSummary] -> ShowS
showList :: [TxSummary] -> ShowS
Show, (forall x. TxSummary -> Rep TxSummary x)
-> (forall x. Rep TxSummary x -> TxSummary) -> Generic TxSummary
forall x. Rep TxSummary x -> TxSummary
forall x. TxSummary -> Rep TxSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TxSummary -> Rep TxSummary x
from :: forall x. TxSummary -> Rep TxSummary x
$cto :: forall x. Rep TxSummary x -> TxSummary
to :: forall x. Rep TxSummary x -> TxSummary
Generic)
data TxInputSummary = TxInputSummary
{ TxInputSummary -> Text
tisUtxo :: !Text
, TxInputSummary -> Text
tisAddress :: !Text
, TxInputSummary -> ValueSummary
tisValue :: !ValueSummary
}
deriving (TxInputSummary -> TxInputSummary -> Bool
(TxInputSummary -> TxInputSummary -> Bool)
-> (TxInputSummary -> TxInputSummary -> Bool) -> Eq TxInputSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TxInputSummary -> TxInputSummary -> Bool
== :: TxInputSummary -> TxInputSummary -> Bool
$c/= :: TxInputSummary -> TxInputSummary -> Bool
/= :: TxInputSummary -> TxInputSummary -> Bool
Eq, Int -> TxInputSummary -> ShowS
[TxInputSummary] -> ShowS
TxInputSummary -> String
(Int -> TxInputSummary -> ShowS)
-> (TxInputSummary -> String)
-> ([TxInputSummary] -> ShowS)
-> Show TxInputSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TxInputSummary -> ShowS
showsPrec :: Int -> TxInputSummary -> ShowS
$cshow :: TxInputSummary -> String
show :: TxInputSummary -> String
$cshowList :: [TxInputSummary] -> ShowS
showList :: [TxInputSummary] -> ShowS
Show, (forall x. TxInputSummary -> Rep TxInputSummary x)
-> (forall x. Rep TxInputSummary x -> TxInputSummary)
-> Generic TxInputSummary
forall x. Rep TxInputSummary x -> TxInputSummary
forall x. TxInputSummary -> Rep TxInputSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TxInputSummary -> Rep TxInputSummary x
from :: forall x. TxInputSummary -> Rep TxInputSummary x
$cto :: forall x. Rep TxInputSummary x -> TxInputSummary
to :: forall x. Rep TxInputSummary x -> TxInputSummary
Generic)
data TxOutputSummary = TxOutputSummary
{ TxOutputSummary -> Text
tosUtxo :: !Text
, TxOutputSummary -> Text
tosAddress :: !Text
, TxOutputSummary -> ValueSummary
tosValue :: !ValueSummary
, TxOutputSummary -> Maybe Text
tosDatum :: !(Maybe Text)
}
deriving (TxOutputSummary -> TxOutputSummary -> Bool
(TxOutputSummary -> TxOutputSummary -> Bool)
-> (TxOutputSummary -> TxOutputSummary -> Bool)
-> Eq TxOutputSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TxOutputSummary -> TxOutputSummary -> Bool
== :: TxOutputSummary -> TxOutputSummary -> Bool
$c/= :: TxOutputSummary -> TxOutputSummary -> Bool
/= :: TxOutputSummary -> TxOutputSummary -> Bool
Eq, Int -> TxOutputSummary -> ShowS
[TxOutputSummary] -> ShowS
TxOutputSummary -> String
(Int -> TxOutputSummary -> ShowS)
-> (TxOutputSummary -> String)
-> ([TxOutputSummary] -> ShowS)
-> Show TxOutputSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TxOutputSummary -> ShowS
showsPrec :: Int -> TxOutputSummary -> ShowS
$cshow :: TxOutputSummary -> String
show :: TxOutputSummary -> String
$cshowList :: [TxOutputSummary] -> ShowS
showList :: [TxOutputSummary] -> ShowS
Show, (forall x. TxOutputSummary -> Rep TxOutputSummary x)
-> (forall x. Rep TxOutputSummary x -> TxOutputSummary)
-> Generic TxOutputSummary
forall x. Rep TxOutputSummary x -> TxOutputSummary
forall x. TxOutputSummary -> Rep TxOutputSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TxOutputSummary -> Rep TxOutputSummary x
from :: forall x. TxOutputSummary -> Rep TxOutputSummary x
$cto :: forall x. Rep TxOutputSummary x -> TxOutputSummary
to :: forall x. Rep TxOutputSummary x -> TxOutputSummary
Generic)
data ValueSummary = ValueSummary
{ ValueSummary -> Integer
vsLovelace :: !Integer
, ValueSummary -> [AssetSummary]
vsAssets :: ![AssetSummary]
}
deriving (ValueSummary -> ValueSummary -> Bool
(ValueSummary -> ValueSummary -> Bool)
-> (ValueSummary -> ValueSummary -> Bool) -> Eq ValueSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ValueSummary -> ValueSummary -> Bool
== :: ValueSummary -> ValueSummary -> Bool
$c/= :: ValueSummary -> ValueSummary -> Bool
/= :: ValueSummary -> ValueSummary -> Bool
Eq, Int -> ValueSummary -> ShowS
[ValueSummary] -> ShowS
ValueSummary -> String
(Int -> ValueSummary -> ShowS)
-> (ValueSummary -> String)
-> ([ValueSummary] -> ShowS)
-> Show ValueSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ValueSummary -> ShowS
showsPrec :: Int -> ValueSummary -> ShowS
$cshow :: ValueSummary -> String
show :: ValueSummary -> String
$cshowList :: [ValueSummary] -> ShowS
showList :: [ValueSummary] -> ShowS
Show, (forall x. ValueSummary -> Rep ValueSummary x)
-> (forall x. Rep ValueSummary x -> ValueSummary)
-> Generic ValueSummary
forall x. Rep ValueSummary x -> ValueSummary
forall x. ValueSummary -> Rep ValueSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ValueSummary -> Rep ValueSummary x
from :: forall x. ValueSummary -> Rep ValueSummary x
$cto :: forall x. Rep ValueSummary x -> ValueSummary
to :: forall x. Rep ValueSummary x -> ValueSummary
Generic)
data AssetSummary = AssetSummary
{ AssetSummary -> Text
asPolicyId :: !Text
, AssetSummary -> Text
asName :: !Text
, AssetSummary -> Integer
asQuantity :: !Integer
}
deriving (AssetSummary -> AssetSummary -> Bool
(AssetSummary -> AssetSummary -> Bool)
-> (AssetSummary -> AssetSummary -> Bool) -> Eq AssetSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AssetSummary -> AssetSummary -> Bool
== :: AssetSummary -> AssetSummary -> Bool
$c/= :: AssetSummary -> AssetSummary -> Bool
/= :: AssetSummary -> AssetSummary -> Bool
Eq, Int -> AssetSummary -> ShowS
[AssetSummary] -> ShowS
AssetSummary -> String
(Int -> AssetSummary -> ShowS)
-> (AssetSummary -> String)
-> ([AssetSummary] -> ShowS)
-> Show AssetSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AssetSummary -> ShowS
showsPrec :: Int -> AssetSummary -> ShowS
$cshow :: AssetSummary -> String
show :: AssetSummary -> String
$cshowList :: [AssetSummary] -> ShowS
showList :: [AssetSummary] -> ShowS
Show, (forall x. AssetSummary -> Rep AssetSummary x)
-> (forall x. Rep AssetSummary x -> AssetSummary)
-> Generic AssetSummary
forall x. Rep AssetSummary x -> AssetSummary
forall x. AssetSummary -> Rep AssetSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. AssetSummary -> Rep AssetSummary x
from :: forall x. AssetSummary -> Rep AssetSummary x
$cto :: forall x. Rep AssetSummary x -> AssetSummary
to :: forall x. Rep AssetSummary x -> AssetSummary
Generic)
instance ToJSON ValueSummary where
toJSON :: ValueSummary -> Value
toJSON ValueSummary
v =
[Pair] -> Value
object
[ Key
"lovelace" Key -> Integer -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= ValueSummary -> Integer
vsLovelace ValueSummary
v
, Key
"assets" Key -> [AssetSummary] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= ValueSummary -> [AssetSummary]
vsAssets ValueSummary
v
]
instance ToJSON AssetSummary where
toJSON :: AssetSummary -> Value
toJSON AssetSummary
a =
[Pair] -> Value
object
[ Key
"policyId" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= AssetSummary -> Text
asPolicyId AssetSummary
a
, Key
"name" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= AssetSummary -> Text
asName AssetSummary
a
, Key
"quantity" Key -> Integer -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= AssetSummary -> Integer
asQuantity AssetSummary
a
]
data ThreatModelTrace = ThreatModelTrace
{ ThreatModelTrace -> Text
tmtName :: !Text
, ThreatModelTrace -> Int
tmtTargetTxIndex :: !Int
, ThreatModelTrace -> [Value]
tmtModifications :: ![Value]
, ThreatModelTrace -> TxSummary
tmtOriginalTx :: !TxSummary
, ThreatModelTrace -> Maybe TxSummary
tmtModifiedTx :: !(Maybe TxSummary)
, ThreatModelTrace -> ThreatModelTraceOutcome
tmtOutcome :: !ThreatModelTraceOutcome
}
deriving (ThreatModelTrace -> ThreatModelTrace -> Bool
(ThreatModelTrace -> ThreatModelTrace -> Bool)
-> (ThreatModelTrace -> ThreatModelTrace -> Bool)
-> Eq ThreatModelTrace
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ThreatModelTrace -> ThreatModelTrace -> Bool
== :: ThreatModelTrace -> ThreatModelTrace -> Bool
$c/= :: ThreatModelTrace -> ThreatModelTrace -> Bool
/= :: ThreatModelTrace -> ThreatModelTrace -> Bool
Eq, Int -> ThreatModelTrace -> ShowS
[ThreatModelTrace] -> ShowS
ThreatModelTrace -> String
(Int -> ThreatModelTrace -> ShowS)
-> (ThreatModelTrace -> String)
-> ([ThreatModelTrace] -> ShowS)
-> Show ThreatModelTrace
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ThreatModelTrace -> ShowS
showsPrec :: Int -> ThreatModelTrace -> ShowS
$cshow :: ThreatModelTrace -> String
show :: ThreatModelTrace -> String
$cshowList :: [ThreatModelTrace] -> ShowS
showList :: [ThreatModelTrace] -> ShowS
Show, (forall x. ThreatModelTrace -> Rep ThreatModelTrace x)
-> (forall x. Rep ThreatModelTrace x -> ThreatModelTrace)
-> Generic ThreatModelTrace
forall x. Rep ThreatModelTrace x -> ThreatModelTrace
forall x. ThreatModelTrace -> Rep ThreatModelTrace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ThreatModelTrace -> Rep ThreatModelTrace x
from :: forall x. ThreatModelTrace -> Rep ThreatModelTrace x
$cto :: forall x. Rep ThreatModelTrace x -> ThreatModelTrace
to :: forall x. Rep ThreatModelTrace x -> ThreatModelTrace
Generic)
data ThreatModelTraceOutcome
=
TMTOPassed
|
TMTOFailed !Text
|
TMTOSkipped !Text
|
TMTOError !Text
deriving (ThreatModelTraceOutcome -> ThreatModelTraceOutcome -> Bool
(ThreatModelTraceOutcome -> ThreatModelTraceOutcome -> Bool)
-> (ThreatModelTraceOutcome -> ThreatModelTraceOutcome -> Bool)
-> Eq ThreatModelTraceOutcome
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ThreatModelTraceOutcome -> ThreatModelTraceOutcome -> Bool
== :: ThreatModelTraceOutcome -> ThreatModelTraceOutcome -> Bool
$c/= :: ThreatModelTraceOutcome -> ThreatModelTraceOutcome -> Bool
/= :: ThreatModelTraceOutcome -> ThreatModelTraceOutcome -> Bool
Eq, Int -> ThreatModelTraceOutcome -> ShowS
[ThreatModelTraceOutcome] -> ShowS
ThreatModelTraceOutcome -> String
(Int -> ThreatModelTraceOutcome -> ShowS)
-> (ThreatModelTraceOutcome -> String)
-> ([ThreatModelTraceOutcome] -> ShowS)
-> Show ThreatModelTraceOutcome
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ThreatModelTraceOutcome -> ShowS
showsPrec :: Int -> ThreatModelTraceOutcome -> ShowS
$cshow :: ThreatModelTraceOutcome -> String
show :: ThreatModelTraceOutcome -> String
$cshowList :: [ThreatModelTraceOutcome] -> ShowS
showList :: [ThreatModelTraceOutcome] -> ShowS
Show, (forall x.
ThreatModelTraceOutcome -> Rep ThreatModelTraceOutcome x)
-> (forall x.
Rep ThreatModelTraceOutcome x -> ThreatModelTraceOutcome)
-> Generic ThreatModelTraceOutcome
forall x. Rep ThreatModelTraceOutcome x -> ThreatModelTraceOutcome
forall x. ThreatModelTraceOutcome -> Rep ThreatModelTraceOutcome x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ThreatModelTraceOutcome -> Rep ThreatModelTraceOutcome x
from :: forall x. ThreatModelTraceOutcome -> Rep ThreatModelTraceOutcome x
$cto :: forall x. Rep ThreatModelTraceOutcome x -> ThreatModelTraceOutcome
to :: forall x. Rep ThreatModelTraceOutcome x -> ThreatModelTraceOutcome
Generic)
instance ToJSON TestRunTrace where
toJSON :: TestRunTrace -> Value
toJSON TestRunTrace
t =
[Pair] -> Value
object
[ Key
"testId" Key -> Int -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TestRunTrace -> Int
trtTestId TestRunTrace
t
, Key
"testName" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TestRunTrace -> Text
trtTestName TestRunTrace
t
, Key
"path" Key -> [Text] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TestRunTrace -> [Text]
trtPath TestRunTrace
t
, Key
"category" Key -> TestCategory -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TestRunTrace -> TestCategory
trtCategory TestRunTrace
t
, Key
"iterations" Key -> [IterationTrace] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TestRunTrace -> [IterationTrace]
trtIterations TestRunTrace
t
]
instance ToJSON IterationTrace where
toJSON :: IterationTrace -> Value
toJSON IterationTrace
t =
[Pair] -> Value
object
[ Key
"index" Key -> Int -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= IterationTrace -> Int
itIndex IterationTrace
t
, Key
"status" Key -> IterationStatus -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= IterationTrace -> IterationStatus
itStatus IterationTrace
t
, Key
"transitions" Key -> [Transition] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= IterationTrace -> [Transition]
itTransitions IterationTrace
t
, Key
"threatModels" Key -> [ThreatModelTrace] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= IterationTrace -> [ThreatModelTrace]
itThreatModels IterationTrace
t
]
instance ToJSON IterationStatus where
toJSON :: IterationStatus -> Value
toJSON IterationStatus
IterationSuccess =
[Pair] -> Value
object [Key
"status" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= (Text
"success" :: Text)]
toJSON (IterationFailure Text
msg) =
[Pair] -> Value
object [Key
"status" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= (Text
"failure" :: Text), Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
msg]
toJSON (IterationDiscarded Text
msg) =
[Pair] -> Value
object [Key
"status" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= (Text
"discarded" :: Text), Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
msg]
instance ToJSON Transition where
toJSON :: Transition -> Value
toJSON Transition
t =
[Pair] -> Value
object
[ Key
"stepIndex" Key -> Int -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Transition -> Int
trStepIndex Transition
t
, Key
"action" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Transition -> Text
trAction Transition
t
, Key
"stateBefore" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Transition -> Value
trStateBefore Transition
t
, Key
"stateAfter" Key -> Value -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Transition -> Value
trStateAfter Transition
t
, Key
"transaction" Key -> Maybe TxSummary -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Transition -> Maybe TxSummary
trTransaction Transition
t
, Key
"result" Key -> TransitionResult -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Transition -> TransitionResult
trResult Transition
t
]
instance ToJSON TransitionResult where
toJSON :: TransitionResult -> Value
toJSON (TransitionSuccess Text
txId) =
[Pair] -> Value
object [Key
"status" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= (Text
"success" :: Text), Key
"txId" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
txId]
toJSON (TransitionFailure Text
err) =
[Pair] -> Value
object [Key
"status" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= (Text
"failure" :: Text), Key
"error" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
err]
instance ToJSON TxSummary where
toJSON :: TxSummary -> Value
toJSON TxSummary
t =
[Pair] -> Value
object
[ Key
"id" Key -> Maybe Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TxSummary -> Maybe Text
txsId TxSummary
t
, Key
"inputs" Key -> [TxInputSummary] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TxSummary -> [TxInputSummary]
txsInputs TxSummary
t
, Key
"outputs" Key -> [TxOutputSummary] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TxSummary -> [TxOutputSummary]
txsOutputs TxSummary
t
, Key
"mint" Key -> Maybe ValueSummary -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TxSummary -> Maybe ValueSummary
txsMint TxSummary
t
, Key
"fee" Key -> Integer -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TxSummary -> Integer
txsFee TxSummary
t
, Key
"signers" Key -> [Text] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TxSummary -> [Text]
txsSigners TxSummary
t
, Key
"validRange" Key -> Maybe Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TxSummary -> Maybe Text
txsValidRange TxSummary
t
]
instance ToJSON TxInputSummary where
toJSON :: TxInputSummary -> Value
toJSON TxInputSummary
t =
[Pair] -> Value
object
[ Key
"utxo" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TxInputSummary -> Text
tisUtxo TxInputSummary
t
, Key
"address" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TxInputSummary -> Text
tisAddress TxInputSummary
t
, Key
"value" Key -> ValueSummary -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TxInputSummary -> ValueSummary
tisValue TxInputSummary
t
]
instance ToJSON TxOutputSummary where
toJSON :: TxOutputSummary -> Value
toJSON TxOutputSummary
t =
[Pair] -> Value
object
[ Key
"utxo" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TxOutputSummary -> Text
tosUtxo TxOutputSummary
t
, Key
"address" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TxOutputSummary -> Text
tosAddress TxOutputSummary
t
, Key
"value" Key -> ValueSummary -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TxOutputSummary -> ValueSummary
tosValue TxOutputSummary
t
, Key
"datum" Key -> Maybe Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TxOutputSummary -> Maybe Text
tosDatum TxOutputSummary
t
]
instance ToJSON ThreatModelTrace where
toJSON :: ThreatModelTrace -> Value
toJSON ThreatModelTrace
t =
[Pair] -> Value
object
[ Key
"name" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= ThreatModelTrace -> Text
tmtName ThreatModelTrace
t
, Key
"targetTxIndex" Key -> Int -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= ThreatModelTrace -> Int
tmtTargetTxIndex ThreatModelTrace
t
, Key
"modifications" Key -> [Value] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= ThreatModelTrace -> [Value]
tmtModifications ThreatModelTrace
t
, Key
"originalTx" Key -> TxSummary -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= ThreatModelTrace -> TxSummary
tmtOriginalTx ThreatModelTrace
t
, Key
"modifiedTx" Key -> Maybe TxSummary -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= ThreatModelTrace -> Maybe TxSummary
tmtModifiedTx ThreatModelTrace
t
, Key
"outcome" Key -> ThreatModelTraceOutcome -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= ThreatModelTrace -> ThreatModelTraceOutcome
tmtOutcome ThreatModelTrace
t
]
instance ToJSON ThreatModelTraceOutcome where
toJSON :: ThreatModelTraceOutcome -> Value
toJSON ThreatModelTraceOutcome
TMTOPassed =
[Pair] -> Value
object [Key
"status" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= (Text
"passed" :: Text)]
toJSON (TMTOFailed Text
reason) =
[Pair] -> Value
object [Key
"status" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= (Text
"failed" :: Text), Key
"reason" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
reason]
toJSON (TMTOSkipped Text
reason) =
[Pair] -> Value
object [Key
"status" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= (Text
"skipped" :: Text), Key
"reason" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
reason]
toJSON (TMTOError Text
msg) =
[Pair] -> Value
object [Key
"status" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= (Text
"error" :: Text), Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
msg]