namespace IRaCIS.Core.Domain.Models;

[Comment("整个系统，上传记录表")]
[Table("FileUploadRecord")]
public class FileUploadRecord : BaseFullAuditEntity
{
    #region 导航属性
    [JsonIgnore]
    public Trial Trial { get; set; }
    [JsonIgnore]
    public Subject Subject { get; set; }
    [JsonIgnore]
    public SubjectVisit SubjectVisit { get; set; }
    [JsonIgnore]
    public DicomStudy DicomStudy { get; set; }
    [JsonIgnore]
    public NoneDicomStudy NoneDicomStudy { get; set; }
    #endregion

    public Guid? TrialId { get; set; }

    public Guid? SubjectId { get; set; }

    public Guid? SubjectVisitId { get; set; }

    public Guid? DicomStudyId { get; set; }

    public Guid? NoneDicomStudyId { get; set; }

    public string StudyCode { get; set; }


    [Comment("文件标识ID")]
    public string FileMarkId { get; set; }

    [Comment("上传批次")]
    public string UploadBatchId { get; set; }

    [Comment("该批次数据类型")]
    public BatchDataType BatchDataType { get; set; }

    [Comment("上传区域")]
    public string UploadRegion { get; set; }

    [Comment("目标区域")]
    public string TargetRegion { get; set; }

    [Comment("文件类型")]
    public string FileType { get; set; }

    public string FileName { get; set; }

    public long FileSize { get; set; }



    [StringLength(1000)]
    public string Path { get; set; }

    [Comment("是否需要同步")]
    public bool? IsNeedSync { get; set; }

    [Comment("同步优先级")]
    public int? Priority { get; set; }

    [Comment("是否已同步-最后一个任务的状态")]
    public bool? IsSync { get; set; }

    [Comment("同步结束时间-最后一个任务的时间")]
    public DateTime? SyncFinishedTime { get; set; }



    public string IP { get; set; }

}

[Comment("同步任务记录表")]
[Table("UploadFileSyncRecord")]
public class UploadFileSyncRecord : BaseFullAuditEntity
{
    #region 导航属性
    [JsonIgnore]
    public FileUploadRecord FileUploadRecord { get; set; }
    #endregion

    public Guid FileUploadRecordId { get; set; }


    public DateTime? StartTime { get; set; }

    public DateTime? EndTime { get; set; }

    public jobState JobState { get; set; }


    public string Msg { get; set; }
}

public enum jobState
{
    //待启动
    PENDING = 0,
    //上传中
    RUNNING = 1,

    SUCCESS = 2,

    FAILED = 3,

    CANCELLED = 4

}

public enum BatchDataType
{
    //前端自定义 1-99
    //后端自定义100开始


    DataReconciliation = 100,

    SiteUserSurvey = 101,

    DICOMDIR = 102,

    EmailAttach = 103,

    ReadingImportTemplete = 105,

    ReadingKeyFile = 106,

    PACSReceive = 107

}

public class CommonUploadRecord : BaseAddAuditEntity
{
    [Comment("文件类型")]
    public string FileType { get; set; }

    public string FileName { get; set; }

    public long FileSize { get; set; }

    [StringLength(1000)]
    public string Path { get; set; }
}