<?php
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');

require_once '../config/database.php';

try {
    $stmt = getDB()->query("SELECT * FROM services ORDER BY order_position ASC");
    $services = $stmt->fetchAll();
    
    echo json_encode([
        'success' => true,
        'data' => $services
    ]);
} catch (Exception $e) {
    http_response_code(500);
    echo json_encode(['success' => false, 'message' => $e->getMessage()]);
}
