<?php

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

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

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