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

namespace TakeoutSaaS.Domain.Membership.Entities;

/// <summary>
/// 积分变动流水。
/// </summary>
public sealed class MemberPointLedger : MultiTenantEntityBase
{
    /// <summary>
    /// 会员标识。
    /// </summary>
    public long MemberId { get; set; }

    /// <summary>
    /// 变动数量，可为负值。
    /// </summary>
    public int ChangeAmount { get; set; }

    /// <summary>
    /// 变动后余额。
    /// </summary>
    public int BalanceAfterChange { get; set; }

    /// <summary>
    /// 变动原因。
    /// </summary>
    public PointChangeReason Reason { get; set; } = PointChangeReason.Purchase;

    /// <summary>
    /// 来源 ID（订单、活动等）。
    /// </summary>
    public long? SourceId { get; set; }

    /// <summary>
    /// 发生时间。
    /// </summary>
    public DateTime OccurredAt { get; set; } = DateTime.UtcNow;

    /// <summary>
    /// 过期时间（如适用）。
    /// </summary>
    public DateTime? ExpireAt { get; set; }
}
