<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class WorkGroupSimpleResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param \Illuminate\Http\Request $request
     * @return array
     */

    public function toArray($request)
    {
        $out = [
            'id'                => $this->id,
            'title'             => $this->title,
            'description'       => $this->description,
            'slug'              => '/' . $this->lang_slug,
            'committeeId'       => $this->committee_id,
        ];

        if (!empty($this->pivot->type)) {
            $out['type'] = $this->pivot->type;
        }

        return $out;
    }
}
