<?php

namespace Litecms\Representative\Repositories\Presenter;

use League\Fractal\TransformerAbstract;
use Hashids;

class RepresentativesTransformer extends TransformerAbstract
{
    public function transform(\Litecms\Representative\Models\Representatives $representatives)
    {
        return [
            'id'                => $representatives->getRouteKey(),
            'key'               => [
                'public'    => $representatives->getPublicKey(),
                'route'     => $representatives->getRouteKey(),
            ], 
            'level_1'           => $representatives->level_1,
            'level_2'           => $representatives->level_2,
            'level_3'           => $representatives->level_3,
            'url'               => [
                'public'    => trans_url('representative/'.$representatives->getPublicKey()),
                'user'      => guard_url('representative/representatives/'.$representatives->getRouteKey()),
            ], 
            'status'            => trans('app.'.$representatives->status),
            'created_at'        => format_date($representatives->created_at),
            'updated_at'        => format_date($representatives->updated_at),
        ];
    }
}