using Learn.Archives.Core.Model.Dto;
using Learn.Archives.Core.Model.Interface;
using SqlSugar;
using System.ComponentModel.DataAnnotations;
using System.Net;
using System.Text.Json;
using UserCenter.Model;
using UserCenter.Model.Enum;
namespace Learn.Archives.Core.Model
{
///
/// 学校业务联系表
///
[SugarTable("schoolbusiness")]
public class SchoolBusiness : EntityBaseId, IDB
{
///
/// 学校ID
///
public long SchoolId { get; set; }
///
/// 学校名称
///
public string SchoolName { get; set; }
///
/// 年级
///
public string Grade { get; set; }
///
/// 赴校人员 逗号分隔
///
[SugarColumn(IsNullable = true, IsJson = true)]
public string[]? SchoolBusinessUser { get; set; }
///
/// 赴校时间
///
public DateTime StartTime { get; set; } = DateTime.Now;
///
/// 赴校备注
///
[SugarColumn(IsNullable = true)]
public string? Remark { get; set; }
///
/// 反馈问题
/// 数据库JSON字段!!!
///
[SugarColumn(IsNullable = true, IsJson = true,ColumnDataType ="text")]
public FeedbackQuestionsDto[]? FeedbackQuestions { get; set; }
///
/// 解决方案的记录
/// 数据库JSON字段!!!
///
[SugarColumn(IsNullable = true, IsJson = true, ColumnDataType = "text")]
public SolutionRecordDto? SolutionRecord { get; set; }
///
/// 赴校问题已解决
///
public bool SolutionEnd { get; set; }
///
/// 开展座谈
///
[SugarColumn(IsNullable =true,Length = 1000)]
public string? Discussion { get; set; }
///
/// 开展班会
///
[SugarColumn(IsNullable = true, Length = 1000)]
public string? ClassMeeting { get; set; }
///
/// 反馈问题数量
///
public long FeedbackCount => FeedbackQuestions?.Count() ?? 0;
///
/// 反馈问题已解决数量
///
public long SolveFeedbackCount => FeedbackQuestions?
.Count(s => s.EndTime != null) ?? 0;
///
/// 开展过座谈
///
public bool IsDiscussion => !string.IsNullOrEmpty(Discussion);
///
/// 开展过班会
///
public bool IsClassMeeting => !string.IsNullOrEmpty(ClassMeeting);
}
}