using EntityFrameworkCore.Projectables;
using IRaCIS.Core.Domain.Share;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace IRaCIS.Core.Domain.Models
{
    [Table("Doctor")]
    public partial class Doctor : Entity, IAuditUpdate, IAuditAdd
    {

        //导航属性
        [JsonIgnore]
        public  List<DoctorDictionary> DoctorDicRelationList { get; set; }=new List<DoctorDictionary>();
        [JsonIgnore]
        public List<TrialExperienceCriteria> TrialExperienceCriteriaList { get; set; }


        // UserDoctor表关联  一个医生 可被多个用户管理
        [JsonIgnore]
        public  List<UserDoctor>  UserList { get; set; }

        [JsonIgnore]
        public List<Enroll> EnrollList { get; set; }



        public string ReviewerCode { get; set; } 

        public int Code { get; set; }


        [StringLength(100)]
        public string Phone { get; set; } = string.Empty;


        [StringLength(100)]
        public string Password { get; set; }


        [StringLength(50)]
        public string ChineseName { get; set; } = string.Empty;


        [StringLength(100)]
        public string FirstName { get; set; } = string.Empty;


        [StringLength(100)]
        public string LastName { get; set; } = string.Empty;

        [Projectable]
        public string FullName => LastName + " / " + FirstName;

        public int Sex { get; set; }


        [StringLength(100)]
        public string EMail { get; set; } = string.Empty;


        [StringLength(100)]
        public string WeChat { get; set; } = string.Empty;


        [StringLength(1000)]
        public string Introduction { get; set; } = string.Empty;

        public Guid? DepartmentId { get; set; } = Guid.Empty;


        [StringLength(100)]
        public string DepartmentOther { get; set; } = string.Empty;

        public Guid? PhysicianId { get; set; }
        public string  Physician { get; set; } = string.Empty;
        public string PhysicianCN { get; set; } = string.Empty;

        public Guid? RankId { get; set; } = Guid.Empty;


        [StringLength(100)]
        public string RankOther { get; set; } = string.Empty;



        public Guid? PositionId { get; set; } = Guid.Empty;


        [StringLength(100)]
        public string PositionOther { get; set; } = string.Empty;

        // 是否可空 意味着 左连接  否则 一直是内连接
        public Guid? HospitalId { get; set; } = Guid.Empty;


        [StringLength(200)]
        public string HospitalOther { get; set; } = string.Empty;





        [StringLength(100)]
        public string ReadingTypeOther { get; set; } = string.Empty;




        [StringLength(100)]
        public string SubspecialityOther { get; set; } = string.Empty;

        public int GCP { get; set; }

        public Guid? GCPId { get; set; } = Guid.Empty;

        public Guid OrganizationId { get; set; } = Guid.Empty;

        public string OtherClinicalExperience { get; set; } = string.Empty;
        public string OtherClinicalExperienceCN { get; set; } = string.Empty;

        public ContractorStatusEnum CooperateStatus { get; set; } = ContractorStatusEnum.Noncooperation;

        public ResumeStatusEnum ResumeStatus { get; set; } = ResumeStatusEnum.Failed;



        [StringLength(512)]
        public string PhotoPath { get; set; } = string.Empty;

        [StringLength(512)]
        public string ResumePath { get; set; } = string.Empty;
        public Guid? SpecialityId { get; set; } = Guid.Empty;

        public string SpecialityOther { get; set; } = string.Empty;

        public string AdminComment { get; set; } = string.Empty;

        public ReviewerInformationConfirmStatus ReviewStatus { get; set; } = ReviewerInformationConfirmStatus.ConfirmRefuse;

        public bool AcceptingNewTrial { get; set; } = false;
        public bool ActivelyReading { get; set; } = false;

        public Guid CreateUserId { get; set; }
        public DateTime CreateTime { get; set; }

        public Guid UpdateUserId { get; set; }
        public DateTime UpdateTime { get; set; }

        public DateTime? LastLoginTime { get; set; }

        public Guid AuditUserId { get; set; } = Guid.Empty;

        public DateTime? AuditTime { get; set; }

        public int Nation { get; set; } = 0; // 支付类型：0-代表中国医生CN，1-代表美国医生US


        public string ReadingTypeOtherCN { get; set; } = string.Empty;
        public string HospitalOtherCN { get; set; } = string.Empty;
        public string PositionOtherCN { get; set; } = string.Empty;
        public string RankOtherCN { get; set; } = string.Empty;
        public string DepartmentOtherCN { get; set; } = string.Empty;
        public string SubspecialityOtherCN { get; set; } = string.Empty;
        public string SpecialityOtherCN { get; set; } = string.Empty;

        [JsonIgnore]
        [ForeignKey("HospitalId")]
        public Hospital Hospital { get; set; }
        [JsonIgnore]
        [ForeignKey("SpecialityId")]
        public virtual Dictionary Speciality { get; set; }
        [JsonIgnore]
        [ForeignKey("DepartmentId")]
        public virtual Dictionary Department { get; set; }

        [JsonIgnore]
        [ForeignKey("RankId")]
        public virtual Dictionary Rank { get; set; }

        [JsonIgnore]
        [ForeignKey("PositionId")]
        public virtual Dictionary Position { get; set; }
        [JsonIgnore]
        public List<Attachment> AttachmentList { get; set; }
        [JsonIgnore]
        public List<DoctorCriterionFile> CriterionFileList { get; set; }

        [JsonIgnore]
        public User User { get; set; }


        //[JsonIgnore]
        //public List<VisitTask> VisitTaskList { get; set; }

        public bool IsVirtual { get; set; }

        public string BlindName { get; set; } = string.Empty;

        public string BlindNameCN { get; set; } = string.Empty;


        public string BlindPublications { get; set; } = string.Empty;
    }
}
