<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class GroupResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        $locale = $request->get('locale');

        return [
            'id' => $this->id,
            'title' => $this->getTranslation('title', $locale),
            'type' => $this->type,
            'file' => $this->getTranslation('file', $locale),
            'is_default' => $this->is_default,
            'hashid' => $this->hashid
        ];
    }
}
