namespace BackOffice.Common.Utilities;

using CMSMicroservice.Protobuf.Protos;
using MudBlazor;

public static class ReportLabels
{
    public static string GetPaymentStatusLabel(bool success) => success ? "موفق" : "در انتظار / ناموفق";

    public static string GetTransactionPaymentStatusLabel(PaymentStatus? status) => status switch
    {
        PaymentStatus.Success => "موفق",
        PaymentStatus.Pending => "در انتظار",
        PaymentStatus.Reject => "رد شده",
        _ => "—"
    };

    public static Color GetTransactionPaymentStatusColor(PaymentStatus? status) => status switch
    {
        PaymentStatus.Success => Color.Success,
        PaymentStatus.Pending => Color.Warning,
        PaymentStatus.Reject => Color.Error,
        _ => Color.Default
    };

    public static string GetTransactionTypeLabel(TransactionType? type) => type switch
    {
        TransactionType.Buy => "خرید",
        TransactionType.DepositIpg => "واریز درگاه",
        TransactionType.DepositExternal1 => "واریز خارجی",
        TransactionType.Withdraw => "برداشت",
        TransactionType.NetworkCommission => "کمیسیون شبکه",
        TransactionType.ClubActivation => "فعال‌سازی باشگاه",
        TransactionType.DiscountWalletCharge => "شارژ کیف تخفیف",
        TransactionType.DiscountShopPurchase => "خرید فروشگاه تخفیف",
        TransactionType.MagicWalletDeposit => "واریز کیف جادویی",
        TransactionType.MagicWalletBonus => "بونوس کیف جادویی",
        TransactionType.CreditWalletCharge => "شارژ کیف اصلی",
        TransactionType.ManualCreditWalletCharge => "شارژ دستی کیف اصلی",
        _ => type?.ToString() ?? "—"
    };

    public static string GetPurchaseMethodLabel(int method) => method switch
    {
        1 => "دایا",
        2 => "درگاه",
        3 => "دستی",
        _ => "نامشخص"
    };

    public static string GetClubMembershipActionLabel(int action) => action switch
    {
        0 => "فعال‌سازی",
        1 => "غیرفعال‌سازی",
        2 => "ویرایش",
        3 => "اصلاح دستی",
        _ => action.ToString()
    };

    public static string GetClubCycleActionLabel(int action) => action switch
    {
        0 => "شروع دوره",
        1 => "ورود به حالت جادویی",
        2 => "پایان حالت جادویی",
        3 => "تکمیل دوره",
        4 => "لغو",
        5 => "اصلاح دستی",
        _ => action.ToString()
    };

    public static string GetMagicStateLabel(int? magicStarted, DateTime? started, DateTime? completed)
    {
        if (completed.HasValue) return "جادویی تکمیل‌شده";
        if (started.HasValue) return "در حالت جادویی";
        return "عادی";
    }

    public static string FormatActiveChange(bool oldActive, bool newActive) =>
        $"{(oldActive ? "فعال" : "غیرفعال")} → {(newActive ? "فعال" : "غیرفعال")}";

    public static string FormatBoolChange(bool oldValue, bool newValue) =>
        $"{(oldValue ? "بله" : "خیر")} → {(newValue ? "بله" : "خیر")}";
}
