import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';

class AppointmentType {
  static var BOOKED = 0;
  static const BOOKED_STR = 'booked';
  static var CONFIRMED = 42;
  static const CONFIRMED_STR = 'confirmed';
  static var ARRIVED = 43;
  static const ARRIVED_STR = 'arrived';

  static bool isConfirmed(AppoitmentAllHistoryResultList appo) {
    return AppointmentType.isValid(appo) &&
        appo.patientStatusType == AppointmentType.CONFIRMED;
  }

  static bool isBooked(AppoitmentAllHistoryResultList appo) {
    return AppointmentType.isValid(appo) &&
        appo.patientStatusType == AppointmentType.BOOKED;
  }

  static bool isArrived(AppoitmentAllHistoryResultList appo) {
    return AppointmentType.isValid(appo) &&
        appo.patientStatusType == AppointmentType.ARRIVED;
  }

  static isValid(appo) {
    return appo != null && appo.patientStatusType != null;
  }

  static int getType(typeName) {
    switch (typeName) {
      case AppointmentType.BOOKED_STR:
        return AppointmentType.BOOKED;
      case AppointmentType.ARRIVED_STR:
        return AppointmentType.ARRIVED;
      case AppointmentType.CONFIRMED_STR:
        return AppointmentType.CONFIRMED;
      default:
        return AppointmentType.BOOKED;
    }
  }
}
