// lib/app/modules/profile/controllers/profile_controller.dart
import 'package:get/get.dart';

class Patient {
  final String id;
  final String name;
  final String room;
  final String deviceId;
  final String guardian; // Wali pasien
  final String status;

  Patient({
    required this.id,
    required this.name,
    required this.room,
    required this.deviceId,
    required this.guardian,
    this.status = 'Aktif',
  });
}

class ProfileController extends GetxController {
  final patients = <Patient>[
    Patient(
      id: '1',
      name: 'Mrs. Shinta',
      room: 'Ruang Mawar 002',
      deviceId: 'SI001',
      guardian: 'Budi Santoso',
    ),
    Patient(
      id: '2',
      name: 'Mr. Parjo',
      room: 'Ruang Melati 001',
      deviceId: 'SI002',
      guardian: 'Siti Nurhaliza',
    ),
  ].obs;

  void addPatient(Patient patient) {
    patients.add(patient);
  }

  void updatePatient(String id, Patient updatedPatient) {
    final index = patients.indexWhere((p) => p.id == id);
    if (index != -1) {
      patients[index] = updatedPatient;
    }
  }

  void deletePatient(String id) {
    patients.removeWhere((patient) => patient.id == id);
  }
}