using System.Collections.Generic; using F4SD.ActionConnector.Enumerations; namespace F4SD.ActionConnector.Models { public sealed class ActionResult { public string ActionId { get; private set; } public ActionResultStatus Status { get; private set; } /// /// HTTP status code for HttpCall actions; null for other types. /// public int? HttpStatusCode { get; private set; } /// /// Raw response body (HttpCall) or serialized output (QuickAction). /// public string RawResponse { get; private set; } /// /// Named fields extracted from the response via jsonPath mappings. /// Populated when DisplayInCockpit is true. /// public IDictionary MappedFields { get; private set; } = new Dictionary(); /// /// Human-readable error message; set when Status is Failure. /// public string ErrorMessage { get; private set; } public static ActionResult Ok(string actionId, string rawResponse = null) => new ActionResult { ActionId = actionId, Status = ActionResultStatus.Success, RawResponse = rawResponse }; public static ActionResult Fail(string actionId, string errorMessage) => new ActionResult { ActionId = actionId, Status = ActionResultStatus.Failure, ErrorMessage = errorMessage }; public static ActionResult Skip(string actionId) => new ActionResult { ActionId = actionId, Status = ActionResultStatus.Skipped }; } }