diff --git a/ECMJobRunner.Domain/Entities/ProfileHistory.cs b/ECMJobRunner.Domain/Entities/ProfileHistory.cs index 7dd3304..a2c4ae9 100644 --- a/ECMJobRunner.Domain/Entities/ProfileHistory.cs +++ b/ECMJobRunner.Domain/Entities/ProfileHistory.cs @@ -1,3 +1,4 @@ +using ECMJobRunner.Domain.ValueObjects; using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; @@ -35,6 +36,18 @@ namespace ECMJobRunner.Domain.Entities [Column("RESULT_ID")] public byte ResultId { get; set; } + /// + /// Gets or sets the result type of the job execution. + /// This property is not mapped to a database column; it wraps . + /// If does not correspond to a defined value, returns . + /// + [NotMapped] + public ResultType Result + { + get => Enum.IsDefined(typeof(ResultType), ResultId) ? (ResultType)ResultId : ResultType.Unknown; + set => ResultId = (byte)value; + } + /// /// Result text/message /// diff --git a/ECMJobRunner.Domain/ValueObjects/ResultType.cs b/ECMJobRunner.Domain/ValueObjects/ResultType.cs new file mode 100644 index 0000000..1919986 --- /dev/null +++ b/ECMJobRunner.Domain/ValueObjects/ResultType.cs @@ -0,0 +1,27 @@ +namespace ECMJobRunner.Domain.ValueObjects; + +/// +/// Represents the result type of a job execution. +/// +public enum ResultType : byte +{ + /// + /// The operation completed successfully. + /// + Ok = 0, + + /// + /// The operation encountered an error. + /// + Error = 1, + + /// + /// The operation completed with warnings. + /// + Warning = 2, + + /// + /// The operation result is unknown. + /// + Unknown = 255 +}