<?php

namespace App\Filament\Resources\TenantResource\Pages;

use App\Filament\Resources\TenantResource;
use App\Services\Audit\SuperAdminAuditLogger;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;

class ViewTenant extends ViewRecord
{
    protected static string $resource = TenantResource::class;

    public static function getNavigationLabel(): string
    {
        return __('admin.tenants.pages.overview');
    }

    public function getTitle(): string
    {
        return __('admin.tenants.pages.overview');
    }

    protected function getHeaderActions(): array
    {
        return [
            Actions\EditAction::make()
                ->after(fn (array $data, $record) => app(SuperAdminAuditLogger::class)->recordModelMutation(
                    'updated',
                    $record,
                    SuperAdminAuditLogger::fieldsMetadata($data),
                    static::class
                )),
            ...TenantResource::lifecycleActions(),
        ];
    }
}
