using System.Collections.Generic; using Newtonsoft.Json; namespace Unity.Pipeline.Editor.Commands.Batch { /// /// Result envelope for the batch command (AUTHAPI-27). Carries a per-operation result in /// input order, how many ops were applied, whether a transactional rollback occurred, and the /// Editor Undo group the whole batch collapsed into. /// sealed class BatchResult { /// Per-operation results, in the same order as the input operations. [JsonProperty("results")] public List Results { get; set; } = new List(); /// Number of operations that executed successfully (before any rollback). [JsonProperty("applied")] public int Applied { get; set; } /// True when a transactional rollback undid every applied operation. [JsonProperty("reverted")] public bool Reverted { get; set; } /// /// Whether the batch ran transactionally (all ops in one Undo group, revert-on-failure). /// Forced false when on_error=continue. /// [JsonProperty("transactional")] public bool Transactional { get; set; } /// The effective error policy: abort or continue. [JsonProperty("onError")] public string OnError { get; set; } /// /// Batch-level abort reason for stops not attributable to a single op's failure: /// "batch time budget exceeded" (the cooperative time_budget_ms ran out between ops) /// or "batch canceled" (cooperative job cancellation). Null otherwise. /// [JsonProperty("error", NullValueHandling = NullValueHandling.Ignore)] public string Error { get; set; } /// The Editor Undo group index the whole batch collapsed into (execution only). [JsonProperty("undoGroup", NullValueHandling = NullValueHandling.Ignore)] public int? UndoGroup { get; set; } /// True when this was a dry run (validation only, zero mutation). [JsonProperty("dryRun", NullValueHandling = NullValueHandling.Ignore)] public bool? DryRun { get; set; } /// Dry run only: whether every operation validated without error. [JsonProperty("valid", NullValueHandling = NullValueHandling.Ignore)] public bool? Valid { get; set; } } /// Result of a single operation within a . sealed class BatchOperationResult { /// The operation's id, echoed back when supplied. [JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)] public string Id { get; set; } /// The command that was (or would be) run. [JsonProperty("command")] public string Command { get; set; } /// /// Whether the operation succeeded. On a dry run this is "would run" (validation passed). /// [JsonProperty("success")] public bool Success { get; set; } /// /// The command's result, shaped identically to running it standalone (optionally projected /// via result_fields, or replaced by a truncation marker for oversized results). /// [JsonProperty("result", NullValueHandling = NullValueHandling.Ignore)] public object Result { get; set; } /// Error message when the operation failed (or failed dry-run validation). [JsonProperty("error", NullValueHandling = NullValueHandling.Ignore)] public string Error { get; set; } /// True for operations not attempted because an earlier op aborted the batch. [JsonProperty("skipped", NullValueHandling = NullValueHandling.Ignore)] public bool? Skipped { get; set; } /// True when the result was replaced by a truncation marker (payload economy). [JsonProperty("resultTruncated", NullValueHandling = NullValueHandling.Ignore)] public bool? ResultTruncated { get; set; } /// /// Whether a transactional rollback can revert this operation's mutations. False for commands /// that mutate state outside the Editor Undo system (asset/file/settings writes) — those only /// run with transactional=false. Unset when the command never resolved. /// [JsonProperty("revertible", NullValueHandling = NullValueHandling.Ignore)] public bool? Revertible { get; set; } } }