<?php

namespace App\Filament\Resources\SupplierResource\Pages;

use App\Filament\Resources\SupplierResource;
use App\Models\Purchasing\Supplier;
use App\Services\AuditLog;
use Filament\Resources\Pages\EditRecord;

class EditSupplier extends EditRecord
{
    protected static string $resource = SupplierResource::class;

    protected function afterSave(): void
    {
        /** @var Supplier $supplier */
        $supplier = $this->record;

        AuditLog::record('supplier.updated', $supplier, ['name' => $supplier->name]);
    }
}
