<?php

namespace App\Http\Resources\Api;

class CourtResource extends BaseResource
{
    protected function defaultData(): array
    {
        return [
            'id'        => $this->id,
            'name'      => $this->name,
            'image'     => $this->imageUrl($this->image),
            'game_id'   => $this->game_id,
            'is_active' => $this->is_active,
        ];
    }

    protected function forShowData(): array
    {
        $default = $this->defaultData();

        return array_merge($default, [
            'description' => $this->description,
            'game'        => new GameResource($this->whenLoaded('game')),
        ]);
    }
}
