<?php

namespace App\Filament\Admin\Widgets;

use App\Models\Wallet;
use Filament\Widgets\StatsOverviewWidget;
use Filament\Widgets\StatsOverviewWidget\Stat;
use Illuminate\Support\Facades\Auth;

class UserWallet extends StatsOverviewWidget
{
    protected function getStats(): array
    {
       $wallet = Wallet::where('user_id', Auth::id())->first();

        return [
            Stat::make('Wallet Balance', $wallet?->balance ?? 0)
                ->description('Your current balance')
                ->descriptionIcon('heroicon-o-wallet')
                ->color($wallet?->balance > 0 ? 'success' : 'gray'),

            Stat::make('Wallet Status', $wallet?->is_active ? 'Active' : 'Inactive')
                ->description('Wallet availability')
                ->descriptionIcon('heroicon-o-shield-check')
                ->color($wallet?->is_active ? 'success' : 'danger'),
        ];
    }
}
