using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Hcs.WebApp.Data.Hcs
{
    public class Campaign
    {
        public enum CampaignType
        {
            [Display(Description = "Экспорт общих справочников")]
            ExportCommonRegistryElements_15_7_0_1,

            [Display(Description = "Экспорт частных справочников")]
            ExportPrivateRegistryElements_15_7_0_1,

            [Display(Description = "Парсинг данных домов")]
            ParseHousesData_15_7_0_1
        }

        public int Id { get; set; }

        public CampaignType Type { get; set; }

        public string InitiatorId { get; set; }

        public DateTime CreatedAt { get; set; }

        public DateTime? StartedAt { get; set; }

        public DateTime? EndedAt { get; set; }

        public int Step { get; set; } = 0;

        public int Progress { get; set; } = 0;

        public string? FailureReason { get; set; }

        public virtual ICollection<Operation>? Operations { get; set; } = null;

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