<?php

namespace NoahVet\Reef\Infrastructure\Http\Get;

use NoahVet\Reef\Application\Port\GetOneQueryServiceInterface as SelfInterface;
use NoahVet\Reef\Application\Query\GetOneQueryInterface;
use NoahVet\Reef\Domain\Serialization\Service\GetOneServiceInterface;

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

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