<?php

namespace App\Filament\Resources\CartDiscountResource\Pages;

use App\Filament\Resources\CartDiscountResource;
use App\Models\Promotions\CartDiscount;
use App\Services\AuditLog;
use Filament\Resources\Pages\EditRecord;

class EditCartDiscount extends EditRecord
{
    protected static string $resource = CartDiscountResource::class;

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

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