<?php

namespace NoahVet\Reef\Infrastructure\Http\Write;

use NoahVet\Reef\Application\Port\WriteOneQueryServiceInterface as SelfInterface;
use NoahVet\Reef\Application\Query\WriteOneQueryInterface;
use NoahVet\Reef\Domain\Serialization\Service\GetOneServiceInterface;

class WriteOneQueryService implements SelfInterface
{
    public function __construct(
        protected readonly GetOneServiceInterface $getOneService,
    ) {
    }

    #[\Override]
    public function __invoke(WriteOneQueryInterface $query): array
    {
        return $this->getOneService->execute(
            object: $query->object(),
            normalizationAttributes: $query->normalizationAttributes(),
            janeModelFQCN: $query->janeModelFQCN(),
            locale: $query->locale(),
            postNormalize: $query->postNormalize(),
        );
    }
}
