using System.ComponentModel.DataAnnotations.Schema;

namespace Hcs.WebApp.Data.Hcs
{
    public class Operation
    {
        public enum OperationType
        {
            NsiCommon_ExportNsiItem_15_7_0_1,
            Nsi_ExportNsiItem_15_7_0_1
        }

        public int Id { get; set; }

        public int CampaignId { get; set; }

        public virtual Campaign Campaign { get; set; } = null!;

        public OperationType Type { get; set; }

        public DateTime CreatedAt { get; set; }

        public DateTime? StartedAt { get; set; }

        public DateTime? EndedAt { get; set; }

        public string? MessageGuid { get; set; }

        public string? FailureReason { get; set; }

        public virtual ICollection<Registry> Registries { get; set; } = [];

        [NotMapped]
        public bool Completed => EndedAt.HasValue;
    }
}
