<?php

namespace App\Controllers\Api;

use App\Models\GasKitAddonModel;

class GasKitAddonsController extends BaseApiController
{
    /**
     * GET api/gas-kit-addons - list add-ons for new gas kit (cooker, hose, regulator, grill, burner, etc.)
     */
    public function index()
    {
        $rows = model(GasKitAddonModel::class)->orderBy('sort_order', 'asc')->orderBy('id', 'asc')->findAll();
        $data = [];
        foreach ($rows as $r) {
            $data[] = [
                'id'    => (int) $r->id,
                'name'  => $r->name,
                'price' => (float) $r->price,
            ];
        }
        return $this->success($data);
    }
}
