<?php
session_start();
header('Content-Type: application/json');
include '../config/database.php';
$db = new Database();
$conn = $db->getConnection();

$gereja_id = $_GET['gereja_id']?? 0;

// AMBIL DARI TABEL users YANG role='gembala' DAN gereja_id = GEREJA INI
$stmt = $conn->prepare("SELECT id, nama FROM users WHERE role = 'gembala' AND gereja_id =? AND status = 'Aktif'");
$stmt->execute([$gereja_id]);
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);

echo json_encode(['status'=>'success', 'data'=>$data]);
?>