<?php

namespace Btravel\Object\Repositories\Presenter;

use League\Fractal\TransformerAbstract;
use Hashids;

class ObjectTransformer extends TransformerAbstract
{
    public function transform(\Btravel\Object\Models\Object $object)
    {
        return [
            'id'                => $object->getRouteKey(),
            'key'               => [
                'public'    => $object->getPublicKey(),
                'route'     => $object->getRouteKey(),
            ], 
            'name'              => $object->name,
            'description'       => $object->description,
            'image'             => $object->image,
            'slug'              => $object->slug,
            'user_id'           => $object->user_id,
            'user_type'         => $object->user_type,
            'deleted_at'        => $object->deleted_at,
            'PRIMARY'           => $object->PRIMARY,
            'url'               => [
                'public'    => trans_url('object/'.$object->getPublicKey()),
                'user'      => guard_url('object/object/'.$object->getRouteKey()),
            ], 
            'status'            => trans('app.'.$object->status),
            'created_at'        => format_date($object->created_at),
            'updated_at'        => format_date($object->updated_at),
        ];
    }
}