<?php
header("Content-Type: application/json; charset=UTF-8");
include_once 'db_connect.php';

// جلب كل التخصصات الأساسية
$stmt = $conn->prepare("SELECT id, name_ar, name_en FROM medical_specialties");
$stmt->execute();
$specialties = $stmt->fetchAll(PDO::FETCH_ASSOC);

// جلب كل التخصصات الدقيقة
$stmt2 = $conn->prepare("SELECT id, specialty_id, name_ar, name_en FROM medical_sub_specialties");
$stmt2->execute();
$sub_specialties = $stmt2->fetchAll(PDO::FETCH_ASSOC);

echo json_encode([
    "status" => "success",
    "specialties" => $specialties,
    "sub_specialties" => $sub_specialties
]);
?>