using IRaCIS.Core.Domain.Share;

namespace IRaCIS.Core.Domain.Models;

[Comment("项目 - 项目发送邮件配置")]
[Table("TrialEmailNoticeConfig")]
public class TrialEmailNoticeConfig : BaseFullDeleteAuditEntity
{
    #region 导航属性
    [JsonIgnore]

    public Trial Trial { get; set; }
    [JsonIgnore]
    public List<TrialEmailNoticeUser> TrialEmailNoticeUserList { get; set; } = new List<TrialEmailNoticeUser>();
    [JsonIgnore]
    public List<TrialEmailBlackUser> TrialEmailBlackUserList { get; set; } = new List<TrialEmailBlackUser>();
    [JsonIgnore]

    public EmailNoticeConfig SysEmailNoticeConfig { get; set; }
    [ForeignKey("TrialReadingCriterionId")]
    [JsonIgnore]
    public ReadingQuestionCriterionTrial TrialReadingCriterion { get; set; }

    #endregion

    public Guid TrialId { get; set; }
    public string AttachCNPath { get; set; } = null!;

    public string AttachName { get; set; } = null!;

    public string AttachNameCN { get; set; } = null!;

    public string AttachPath { get; set; } = null!;

    public string AuthorizationCode { get; set; } = null!;

    public int BusinessLevelEnum { get; set; }

    public int BusinessModuleEnum { get; set; }

    public EmailBusinessScenario BusinessScenarioEnum { get; set; }

    public string Code { get; set; } = null!;

    public CriterionType? CriterionTypeEnum { get; set; }

    public string Description { get; set; } = null!;

    public string EmailCron { get; set; } = null!;

    [MaxLength]
    public string? EmailHtmlContent { get; set; }

    [MaxLength]
    public string? EmailHtmlContentCN { get; set; }

    public string EmailTopic { get; set; } = null!;

    public string EmailTopicCN { get; set; } = null!;

    public int EmailTypeEnum { get; set; }

    public int EmailUrgentEnum { get; set; }

    public string FromEmail { get; set; } = null!;

    public string FromName { get; set; } = null!;

    public bool IsAutoSend { get; set; }

    public bool IsDistinguishCriteria { get; set; }

    public bool IsEnable { get; set; }

    public bool IsReturnRequired { get; set; }

    public string SMTPServerAddress { get; set; } = null!;

    public int SMTPServerPort { get; set; }

    public Guid? SysEmailNoticeConfigId { get; set; }

    public Guid? TrialReadingCriterionId { get; set; }

}

[Comment("项目 - 项目邮件用户黑名单")]
[Table("TrialEmailBlackUser")]
public class TrialEmailBlackUser : Entity
{
    [JsonIgnore]
    public TrialEmailNoticeConfig TrialEmailNoticeConfig { get; set; }

    [JsonIgnore]
    public User User { get; set; }
    public Guid TrialEmailNoticeConfigId { get; set; }
    public Guid UserId { get; set; }
}
