<?php

namespace Lucent\Revision\Listener;

use Lucent\Record\Event\RecordCreated;
use Lucent\Record\Event\RecordUpdated;
use Lucent\Revision\RevisionService;

class CreateRevision
{

    public function __construct(
        private RevisionService $revisionService
    )
    {
    }

    public function handle(RecordCreated|RecordUpdated $event): void
    {
        $this->revisionService->create($event->record, $event->edges);
    }

}