<?php

namespace Modules\Payment\Filament\Resources\Payments;

use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use Modules\Payment\Filament\Resources\Payments\Pages\ListPayments;
use Modules\Payment\Filament\Resources\Payments\Pages\ViewPayment;
use Modules\Payment\Filament\Resources\Payments\Schemas\PaymentInfolist;
use Modules\Payment\Filament\Resources\Payments\Tables\PaymentsTable;
use Modules\Payment\Models\Payment;
use UnitEnum;

/**
 * Read-only by design: payments are created through the API/webhook flow
 * (T5.8–T5.10), not hand-entered in the admin — so this resource has no
 * create/edit form, just a list with filters and a detail view.
 */
class PaymentResource extends Resource
{
    protected static ?string $model = Payment::class;

    protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedBanknotes;

    protected static string|UnitEnum|null $navigationGroup = 'Operations';

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

    public static function infolist(Schema $schema): Schema
    {
        return PaymentInfolist::configure($schema);
    }

    public static function getPages(): array
    {
        return [
            'index' => ListPayments::route('/'),
            'view' => ViewPayment::route('/{record}'),
        ];
    }
}
