<?php

namespace App\Filament\Resources\DealResource\Pages;

use App\Filament\Resources\DealResource;
use App\Models\Promotions\Deal;
use App\Services\AuditLog;
use Filament\Resources\Pages\CreateRecord;

class CreateDeal extends CreateRecord
{
    protected static string $resource = DealResource::class;

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

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