using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace YBEE.EQM.Core;

/// <summary>
/// 监测机构数据上报类型
/// </summary>
[Comment("监测机构数据上报类型")]
public class ExamOrgDataReport : IEntity
{
    /// <summary>
    /// 主键
    /// </summary>
    [Comment("主键")]
    [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int Id { get; set; }
    /// <summary>
    /// 监测机构ID
    /// </summary>
    [Comment("监测机构ID")]
    [Required]
    public int ExamOrgId { get; set; }
    /// <summary>
    /// 监测计划ID
    /// </summary>
    [Comment("监测计划ID")]
    [Required]
    public int ExamPlanId { get; set; }
    /// <summary>
    /// 机构ID
    /// </summary>
    [Comment("机构ID")]
    [Required]
    public short SysOrgId { get; set; }
    /// <summary>
    /// 上报类型
    /// </summary>
    [Comment("上报类型")]
    [Required, Column(TypeName = "smallint")]
    public DataReportType Type { get; set; }
    /// <summary>
    /// 状态
    /// </summary>
    [Comment("状态")]
    [Required, Column(TypeName = "smallint")]
    public DataReportStatus Status { get; set; } = DataReportStatus.UNREPORT;
    /// <summary>
    /// 上报人用户ID
    /// </summary>
    [Comment("上报人用户ID")]
    public int? ReportSysUserId { get; set; }
    /// <summary>
    /// 开始时间
    /// </summary>
    [Comment("开始时间")]
    public DateTime? ReportTime { get; set; }
    /// <summary>
    /// 备注
    /// </summary>
    [Comment("备注")]
    public string Remark { get; set; }

    /// <summary>
    /// 佐证材料
    /// </summary>
    [Comment("佐证材料")]
    [Column(TypeName = "json")]
    public string Attachments { get; set; } = "[]";

    /// <summary>
    /// 一对一引用（监测机构）
    /// </summary>
    public virtual ExamOrg ExamOrg { get; set; }
    /// <summary>
    /// 一对一引用（用户）
    /// </summary>
    public virtual SysUser ReportSysUser { get; set; }
}
