<?php

namespace App\Http\Controllers\V3\Dashboard\RoadItem;

use App\Http\Controllers\Controller;
use App\Http\Traits\ApiResponse;
use App\Models\RoadItemsProject;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class DetailController extends Controller
{
    use ApiResponse;

    public function machines(RoadItemsProject $roadItemsProject): JsonResponse
    {
        return $this->successResponse($roadItemsProject->cmmsMachines()->get(['cmms_machines.id', 'cmms_machines.machine_code', 'cmms_machines.car_name', 'cmms_machines.plak_number']));
    }

    public function rahdaran(RoadItemsProject $roadItemsProject): JsonResponse
    {
        return $this->successResponse($roadItemsProject->rahdaran()->get(['rahdaran.id', 'rahdaran.name', 'rahdaran.code']));
    }

    public function files(RoadItemsProject $roadItemsProject): JsonResponse
    {
        return $this->successResponse($roadItemsProject->files()->get(['path']));
    }
}
