<?php
require_once __DIR__ . '/../../models/Database.php';
use Models\Database;

header('Content-Type: application/json');

$pdo = Database::getInstance()->getConnection();

$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;

if ($id > 0) {
    $stmt = $pdo->prepare("SELECT cis, co2 FROM employees WHERE id = ?");
    $stmt->execute([$id]);
    $row = $stmt->fetch();
    echo json_encode($row);
} else {
    echo json_encode(['error' => 'ID invalide']);
}
