using TakeoutSaaS.Shared.Abstractions.Entities;

namespace TakeoutSaaS.Domain.Membership.Entities;

/// <summary>
/// 会员等级定义。
/// </summary>
public sealed class MemberTier : MultiTenantEntityBase
{
    /// <summary>
    /// 等级名称。
    /// </summary>
    public string Name { get; set; } = string.Empty;

    /// <summary>
    /// 所需成长值。
    /// </summary>
    public int RequiredGrowth { get; set; }

    /// <summary>
    /// 图标键。
    /// </summary>
    public string IconKey { get; set; } = "user";

    /// <summary>
    /// 主题色。
    /// </summary>
    public string ColorHex { get; set; } = "#999999";

    /// <summary>
    /// 升级规则类型（none/amount/count/both）。
    /// </summary>
    public string UpgradeRuleType { get; set; } = "none";

    /// <summary>
    /// 升级累计消费门槛。
    /// </summary>
    public decimal? UpgradeAmountThreshold { get; set; }

    /// <summary>
    /// 升级消费次数门槛。
    /// </summary>
    public int? UpgradeOrderCountThreshold { get; set; }

    /// <summary>
    /// 降级观察窗口天数。
    /// </summary>
    public int DowngradeWindowDays { get; set; } = 90;

    /// <summary>
    /// 是否默认等级。
    /// </summary>
    public bool IsDefault { get; set; }

    /// <summary>
    /// 等级权益（JSON）。
    /// </summary>
    public string BenefitsJson { get; set; } = string.Empty;

    /// <summary>
    /// 排序值。
    /// </summary>
    public int SortOrder { get; set; } = 100;
}
