using MiniExcelLibs.Attributes;
using System.ComponentModel.DataAnnotations;

namespace IRaCIS.Core.Application.MassTransit.Command
{
    public record ConsistenCheckCommand
    {
        public List<CheckViewModel> ETCList { get; set; } = new List<CheckViewModel>();

        public Guid TrialId { get; set; }
    }

    public record ConsistenCheckResult
    {

    }

    public class CheckDBModel : CheckViewModel
    {

        public Guid SubjectVisitId { get; set; }

        public Guid StudyId { get; set; }
    }




    //[ExcelImporter(/*ImportResultFilter = typeof(ImportResultFilteTest),*/ IsLabelingError = true)]

    public class CheckViewModel
    {
        //[Required(ErrorMessage = "中心编号不能为空")]
        //[ImporterHeader(Name = "Site ID", AutoTrim = true)]
        [ExcelColumnName("Site ID")]
        public string SiteCode { get; set; } = string.Empty;


        //[Required(ErrorMessage = "受试者筛选号不能为空")]
        //[ImporterHeader(Name = "Subject ID", AutoTrim = true)]
        [ExcelColumnName("Subject ID")]
        public string SubjectCode { get; set; } = string.Empty;

        //[Required(ErrorMessage = "访视名称不能为空")]
        //[ImporterHeader(Name = "Visit Name", AutoTrim = true)]
        [ExcelColumnName("Visit Name")]
        public string VisitName { get; set; } = string.Empty;



        //[Required(ErrorMessage = "检查日期不能为空")]
        [CanConvertToTime(ErrorMessage = "Does not conform to Study Date format")]

        //[ImporterHeader(Name = "Study Date", AutoTrim = true)]
        [ExcelColumnName("Study Date")]
        public string StudyDate { get; set; } = string.Empty;



        //[Required(ErrorMessage = "Modality不能为空")]
        //[ImporterHeader(Name = "Modality", AutoTrim = true)]
        [ExcelColumnName("Modality")]
        public string Modality { get; set; } = string.Empty;




        public override bool Equals(object? obj)
        {
            if (obj == null) return false;

            var checkModel = obj as CheckViewModel;

            if (checkModel is not null)
            {
                return SiteCode == checkModel.SiteCode && SubjectCode == checkModel.SubjectCode && VisitName == checkModel.VisitName && StudyDate == checkModel.StudyDate && Modality == checkModel.Modality;
            }
            else
            {
                return false;
            }
        }
        public override int GetHashCode()
        {
            return (SiteCode + SubjectCode + VisitName + StudyDate + Modality).GetHashCode();
        }
    }



}
