<?php

namespace Bixo\Niche\Repositories\Presenter;

use League\Fractal\TransformerAbstract;
use Hashids;

class NicheTransformer extends TransformerAbstract
{
    public function transform(\Bixo\Niche\Models\Niche $niche)
    {
        return [
            'id'                => $niche->getRouteKey(),
            'key'               => [
                'public'    => $niche->getPublicKey(),
                'route'     => $niche->getRouteKey(),
            ], 
            'location_id'       => $niche->location_id,
            'user_id'           => $niche->user_id,
            'deleted_at'        => $niche->deleted_at,
            'url'               => [
                'public'    => trans_url('niche/'.$niche->getPublicKey()),
                'user'      => guard_url('niche/niche/'.$niche->getRouteKey()),
            ], 
            'status'            => trans('app.'.$niche->status),
            'created_at'        => format_date($niche->created_at),
            'updated_at'        => format_date($niche->updated_at),
        ];
    }
}