therapistModel = new Therapist(); } /** * GET /api/v1/therapists - Get all therapists with profiles & workload score */ public function index(): void { JwtAuthMiddleware::handle(); $branchId = isset($_GET['branch_id']) ? (int)$_GET['branch_id'] : null; Response::success('รายชื่อหมอนวดและสถานะภาระงาน (Workload)', $this->therapistModel->getWithProfiles($branchId)); } /** * PUT /api/v1/therapists/{id}/availability - Toggle Availability */ public function toggleAvailability(int $id): void { JwtAuthMiddleware::handle(); $input = json_decode(file_get_contents('php://input'), true) ?? $_POST; $available = !empty($input['is_available']); $this->therapistModel->setAvailability($id, $available); Response::success('อัปเดตสถานะความพร้อมให้บริการของหมอนวดแล้ว', ['therapist_id' => $id, 'is_available' => $available ? 1 : 0]); } }