<?php

require_once __DIR__.'/../../config/database.php';
require_once __DIR__.'/../../auth/auth_session.php';

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

$user = get_authenticated_user();
$pdo = database();

$stmt=$pdo->prepare("
SELECT id,first_name,last_name
FROM users
WHERE company_id=? AND status='active'
ORDER BY first_name
");

$stmt->execute([$user['company_id']]);

echo json_encode([
"status"=>"success",
"data"=>$stmt->fetchAll(PDO::FETCH_ASSOC)
]);