namespace YBEE.EQM.Application;

/// <summary>
/// 监测数据上报类型上传输出参数
/// </summary>
public class UploadExamDataOutput<T> where T : UploadExamDataBase
{
    /// <summary>
    /// 表格结构是否符合要求
    /// </summary>
    public bool StructureCorrect { get; set; } = false;
    /// <summary>
    /// 错误消息
    /// </summary>
    public List<string> ErrorMessage { get; set; } = new();
    /// <summary>
    /// 总行数
    /// </summary>
    public int TotalRowCount { get; set; } = 0;
    /// <summary>
    /// 错误行数
    /// </summary>
    public int ErrorRowCount { get; set; } = 0;
    /// <summary>
    /// 成功行数
    /// </summary>
    public int SuccessRowCount => TotalRowCount - ErrorRowCount;
    /// <summary>
    /// 行数据
    /// </summary>
    public List<T> Rows { get; set; } = new();
}

/// <summary>
/// 导入数据行基类
/// </summary>
public abstract class UploadExamDataBase
{
    /// <summary>
    /// ID
    /// </summary>
    [Required]
    public int RowNumber { get; set; }
    /// <summary>
    /// 是否成功
    /// </summary>
    public bool IsSuccess { get; set; } = false;
    /// <summary>
    /// 错误消息
    /// </summary>
    public List<string> ErrorMessage { get; set; } = new();
}
