<?php

namespace NoahVet\Reef\RabbitMQ\Notification\Factory;

use NoahVet\Reef\Domain\Security\Model\Resource;
use NoahVet\Reef\RabbitMQ\Notification\ReefNotification;
use NoahVet\Reef\RabbitMQ\Notification\ReefNotificationInterface;

class ReefNotificationFactory implements ReefNotificationFactoryInterface
{
    public function __construct(
        private readonly string $reefClientId,
    ) {
    }

    /**
     * @param array<string, string|int|float|bool|array<string, string|int|float|bool>> $rawData
     */
    #[\Override]
    public function createNotification(
        Resource $resource,
        string $action,
        array $rawData,
    ): ReefNotificationInterface {
        return new ReefNotification(
            $this->reefClientId,
            $resource->getResourceType()->getSlug(),
            $resource->getResourceId(),
            $action,
            $rawData,
        );
    }
}
