<?php

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

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

/**
 * Class SumarHodnoteniaDtoTransformer
 */
final class SumarHodnoteniaDtoTransformer extends TransformerAbstract
{
    /**
     * @param \App\Http\Controllers\API\V1\Informacia\Frontend\SumarHodnoteniDto $dto
     *
     * @return array
     */
    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),
                        ],
                    ),
                ],
            ],
        );
    }
}
