using System;
using System.Collections.Generic;

namespace NPP.SmartSchedue.Api.Contracts.Services.Notification.Output;

/// <summary>
/// 批量发送邮件输出
/// </summary>
public class BatchSendEmailOutput
{
    /// <summary>
    /// 总发送数量
    /// </summary>
    public int TotalCount { get; set; }

    /// <summary>
    /// 成功发送数量
    /// </summary>
    public int SuccessCount { get; set; }

    /// <summary>
    /// 失败发送数量
    /// </summary>
    public int FailedCount { get; set; }

    /// <summary>
    /// 发送时间
    /// </summary>
    public DateTime SendTime { get; set; } = DateTime.Now;

    /// <summary>
    /// 详细发送结果
    /// </summary>
    public List<SendEmailOutput> Results { get; set; } = new List<SendEmailOutput>();

    /// <summary>
    /// 整体是否成功（所有邮件都发送成功）
    /// </summary>
    public bool IsAllSuccess => FailedCount == 0;

    /// <summary>
    /// 成功率
    /// </summary>
    public decimal SuccessRate => TotalCount > 0 ? (decimal)SuccessCount / TotalCount : 0;
}