using TakeoutSaaS.Domain.Membership.Enums;
using TakeoutSaaS.Shared.Abstractions.Entities;

namespace TakeoutSaaS.Domain.Membership.Entities;

/// <summary>
/// 会员消息触达收件明细。
/// </summary>
public sealed class MemberReachRecipient : MultiTenantEntityBase
{
    /// <summary>
    /// 消息标识。
    /// </summary>
    public long MessageId { get; set; }

    /// <summary>
    /// 会员标识。
    /// </summary>
    public long MemberId { get; set; }

    /// <summary>
    /// 渠道。
    /// </summary>
    public MemberMessageChannel Channel { get; set; } = MemberMessageChannel.InApp;

    /// <summary>
    /// 手机号快照。
    /// </summary>
    public string? Mobile { get; set; }

    /// <summary>
    /// 微信 OpenId 快照。
    /// </summary>
    public string? OpenId { get; set; }

    /// <summary>
    /// 发送状态。
    /// </summary>
    public MemberMessageRecipientStatus Status { get; set; } = MemberMessageRecipientStatus.Pending;

    /// <summary>
    /// 发送时间（UTC）。
    /// </summary>
    public DateTime? SentAt { get; set; }

    /// <summary>
    /// 已读时间（UTC）。
    /// </summary>
    public DateTime? ReadAt { get; set; }

    /// <summary>
    /// 转化时间（UTC）。
    /// </summary>
    public DateTime? ConvertedAt { get; set; }

    /// <summary>
    /// 失败摘要。
    /// </summary>
    public string? ErrorMessage { get; set; }
}

