<?php

namespace Game\Game\Repositories\Presenter;

use League\Fractal\TransformerAbstract;
use Hashids;

class GameTransformer extends TransformerAbstract
{
    public function transform(\Game\Game\Models\Game $game)
    {
        return [
            'id'                => $game->getRouteKey(),
            'key'               => [
                'public'    => $game->getPublicKey(),
                'route'     => $game->getRouteKey(),
            ], 
            'name'              => $game->name,
            'slug'              => $game->slug,
            'thumbnail'         => $game->thumbnail,
            'description'       => $game->description,
            'images'            => $game->images,
            'featured'          => $game->featured,
            'game_path'         => $game->game_path,
            'play_count'        => $game->play_count,
            'category_id'       => $game->category_id,
            'user_id'           => $game->user_id,
            'user_type'         => $game->user_type,
            'url'               => [
                'public'    => trans_url('game/'.$game->getPublicKey()),
                'user'      => guard_url('game/game/'.$game->getRouteKey()),
            ], 
            'status'            => trans('app.'.$game->status),
            'created_at'        => format_date($game->created_at),
            'updated_at'        => format_date($game->updated_at),
        ];
    }
}