using System; using System.ComponentModel.DataAnnotations; namespace DiunaBI.Core.Models; public class QueueJob { [Key] public Guid Id { get; set; } = Guid.NewGuid(); [Required] public Guid LayerId { get; set; } [Required] [MaxLength(200)] public string LayerName { get; set; } = string.Empty; [Required] [MaxLength(100)] public string PluginName { get; set; } = string.Empty; [Required] public JobType JobType { get; set; } public int Priority { get; set; } = 0; // 0 = highest priority [Required] public DateTime CreatedAt { get; set; } = DateTime.UtcNow; public int RetryCount { get; set; } = 0; public int MaxRetries { get; set; } = 5; [Required] public JobStatus Status { get; set; } = JobStatus.Pending; [MaxLength(1000)] public string? LastError { get; set; } public DateTime? LastAttemptAt { get; set; } public DateTime? CompletedAt { get; set; } [Required] public Guid CreatedById { get; set; } [Required] public DateTime CreatedAtUtc { get; set; } = DateTime.UtcNow; [Required] public Guid ModifiedById { get; set; } [Required] public DateTime ModifiedAtUtc { get; set; } = DateTime.UtcNow; } public enum JobType { Import = 0, Process = 1 } public enum JobStatus { Pending, Running, Completed, Failed, Retrying }