<?php

namespace App\Http\Controllers\API\V1\Informacia\Frontend;

use Elceka\Laravel\HashId\Facades\Hasher;
use PHPOpenSourceSaver\Fractal\TransformerAbstract;

/**
 * Class SumarHodnoteniaDtoTransformer
 *
 * @package App\Http\Controllers\API\V1\Informacia\Frontend
 */
final class SumarHodnoteniaDtoTransformer extends TransformerAbstract
{
    public function transform(SumarHodnoteniDto $dto): array
    {
        return array_merge(
            $dto->toArray(),
            [
                'links' => [
                    'self' => route(
                        'app.api.frontend.informacie.hodnotenia.get',
                        [
                            'informaciaHashId' => Hasher::encode($dto->id),
                        ],
                    ),
                ],
            ],
        );
    }
}
