<?php

namespace Modules\Identity\Filament\Resources\AuditLogs;

use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
use Modules\Identity\Filament\Resources\AuditLogs\Pages\ListAuditLogs;
use Modules\Identity\Filament\Resources\AuditLogs\Pages\ViewAuditLog;
use Modules\Identity\Filament\Resources\AuditLogs\Schemas\AuditLogInfolist;
use Modules\Identity\Filament\Resources\AuditLogs\Tables\AuditLogsTable;
use Spatie\Activitylog\Models\Activity;
use UnitEnum;

/**
 * Read-only by design (T6.2, gated by view_audit_log — AuditLogPolicy):
 * every row here comes from the LogsActivity trait on Booking/Payment/
 * Refund/catalog/pricing models, never hand-entered.
 */
class AuditLogResource extends Resource
{
    protected static ?string $model = Activity::class;

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

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

    protected static ?string $navigationLabel = 'Audit Log';

    protected static ?string $modelLabel = 'Audit Log Entry';

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

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

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