json([ 'status' => 'ok', 'service' => 'commerce-provisioning', 'timestamp' => now()->toIso8601String(), ]); } /** * List all active, visible products. * * GET /api/v1/provisioning/products * * Query parameters: * - category: filter by product category * - type: filter by product type (simple, virtual, subscription, etc.) * - per_page: pagination size (default 25, max 100) */ public function index(Request $request): JsonResponse { $query = Product::query() ->active() ->visible() ->orderBy('sort_order'); if ($category = $request->get('category')) { $query->where('category', $category); } if ($type = $request->get('type')) { $query->where('type', $type); } $perPage = min((int) $request->get('per_page', 25), 100); $products = $query->paginate($perPage); return response()->json($products); } /** * Show a single product by SKU code. * * GET /api/v1/provisioning/products/{code} */ public function show(string $code): JsonResponse { $product = Product::where('sku', strtoupper($code)) ->active() ->visible() ->first(); if (! $product) { return response()->json([ 'error' => 'not_found', 'message' => "Product with SKU '{$code}' not found", ], 404); } return response()->json(['data' => $product]); } }