<?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\CreateRecord;

class CreateCartDiscount extends CreateRecord
{
    protected static string $resource = CartDiscountResource::class;

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

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