<?php

namespace App\Filament\Resources\ResellerWithdrawRequests;

use App\Filament\Resources\ResellerWithdrawRequests\Pages\EditResellerWithdrawRequest;
use App\Filament\Resources\ResellerWithdrawRequests\Pages\ListResellerWithdrawRequests;
use App\Filament\Resources\ResellerWithdrawRequests\Schemas\ResellerWithdrawRequestForm;
use App\Filament\Resources\ResellerWithdrawRequests\Tables\ResellerWithdrawRequestsTable;
use App\Models\ResellerWithdrawRequest;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;

class ResellerWithdrawRequestResource extends Resource
{
    protected static ?string $model = ResellerWithdrawRequest::class;

    protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-banknotes';
    protected static string|\UnitEnum|null $navigationGroup = 'Reseller System';
    protected static ?string $navigationLabel = 'Payout Requests';
    protected static ?string $modelLabel = 'Payout Request';
    protected static ?string $pluralModelLabel = 'Payout Requests';
    protected static ?int $navigationSort = 5;

    public static function getNavigationBadge(): ?string
    {
        return static::getModel()::where('status', 'pending')->count() ?: null;
    }

    public static function getNavigationBadgeColor(): ?string
    {
        return 'warning';
    }

    public static function canCreate(): bool
    {
        return true;
    }

    public static function canDelete(\Illuminate\Database\Eloquent\Model $record): bool
    {
        return false;
    }

    public static function form(Schema $schema): Schema
    {
        return ResellerWithdrawRequestForm::configure($schema);
    }

    public static function table(Table $table): Table
    {
        return ResellerWithdrawRequestsTable::configure($table);
    }

    public static function getRelations(): array
    {
        return [
            //
        ];
    }

    public static function getPages(): array
    {
        return [
            'index' => ListResellerWithdrawRequests::route('/'),
            'edit' => EditResellerWithdrawRequest::route('/{record}/edit'),
        ];
    }
}
