<?php

namespace App\Controllers\Api;

use App\Models\RescueServiceModel;

class RescueServicesController extends BaseApiController
{
    /**
     * GET api/rescue-services - list Rescue+ service types (Flat tire, Oil change, etc.)
     */
    public function index()
    {
        $model = model(RescueServiceModel::class);
        $list  = $model->where('status', 'active')->findAll();
        $data  = array_map(static function ($row) {
            return [
                'id'    => (int) $row->id,
                'name'  => $row->name,
                'price' => (float) $row->price,
            ];
        }, $list);
        return $this->success($data);
    }
}
