import 'dart:ui';
import 'package:hmg_qline/models/kiosk_language_config_model.dart';
import 'package:hmg_qline/models/kiosk_queue_model.dart';
import 'package:hmg_qline/utilities/enums.dart';
import 'package:hmg_qline/utilities/extensions.dart';

class GlobalConfigurationsModel {
  int? id;
  int? configType;
  String? description;
  int? counterStart;
  int? counterEnd;
  int concurrentCallDelaySec = 1;
  int? voiceType;
  String? voiceTypeText;
  LanguageEnum screenLanguageEnum = LanguageEnum.english;
  String? screenLanguageText;
  TextDirection textDirection = TextDirection.ltr;
  LanguageEnum voiceLanguageEnum = LanguageEnum.english;
  String? voiceLanguageText;
  int screenMaxDisplayPatients = 10;
  bool? isNotiReq;
  int? prioritySMS;
  int? priorityWhatsApp;
  int? priorityEmail;
  String ticketNoText = "Ticket Number";
  String postVoiceText = "Please Visit Counter";
  String? roomText;
  int? roomNo;
  bool? isRoomNoRequired;
  String? counterText;
  String? queueNoText;
  String? callForText;
  String? currentServeText;
  String maxText = "";
  String minText = "";
  String nextPrayerText = "";
  String weatherText = "Weather";
  String? fajarText;
  String? dhuhrText;
  String? asarText;
  String? maghribText;
  String? ishaText;
  bool? isActive;
  int? createdBy;
  String? createdOn;
  dynamic editedBy;
  dynamic editedOn;
  bool isToneReq = false;
  bool isVoiceReq = false;
  ScreenOrientationEnum orientationTypeEnum = ScreenOrientationEnum.portraitUp;
  bool? isTurnOn;
  int? waitingAreaType;
  int? gender;
  bool isWeatherReq = false;
  bool isPrayerTimeReq = false;
  bool isRssFeedReq = false;
  QTypeEnum qTypeEnum = QTypeEnum.appointment;
  ScreenTypeEnum screenTypeEnum = ScreenTypeEnum.waitingAreaScreen;
  int? projectID;
  double? projectLatitude;
  double? projectLongitude;
  int? cityKey;
  List<KioskQueueModel>? kioskQueueList;
  List<KioskLanguageConfigModel>? kioskLanguageConfigList;

  String vitalSignText = "Vital Sign";
  String doctorText = "Doctor";
  String procedureText = "Procedure";
  String vaccinationText = "Vaccination";
  String nebulizationText = "Nebulization";
  String callForVitalSignText = "Call for Vital Sign";
  String callForDoctorText = "Call for Doctor";
  String callForProcedureText = "Call for Procedure";
  String callForVaccinationText = "Call for Vaccination";
  String callForNebulizationText = "Call for Nebulization";

  GlobalConfigurationsModel({
    this.id,
    this.configType,
    this.description,
    this.counterStart,
    this.counterEnd,
    this.concurrentCallDelaySec = 1,
    this.voiceType,
    this.voiceTypeText,
    this.screenLanguageEnum = LanguageEnum.english,
    this.screenLanguageText,
    this.textDirection = TextDirection.ltr,
    this.voiceLanguageEnum = LanguageEnum.english,
    this.voiceLanguageText,
    this.screenMaxDisplayPatients = 10,
    this.isNotiReq,
    this.prioritySMS,
    this.priorityWhatsApp,
    this.priorityEmail,
    this.ticketNoText = "Ticket Number",
    this.postVoiceText = "Please Visit Counter",
    this.roomText,
    this.roomNo,
    this.isRoomNoRequired = true,
    this.counterText,
    this.queueNoText,
    this.callForText,
    this.currentServeText,
    this.maxText = "",
    this.minText = "",
    this.nextPrayerText = "",
    this.weatherText = "Weather",
    this.fajarText,
    this.dhuhrText,
    this.asarText,
    this.maghribText,
    this.ishaText,
    this.isActive,
    this.createdBy,
    this.createdOn,
    this.editedBy,
    this.editedOn,
    this.isToneReq = false,
    this.isVoiceReq = false,
    this.orientationTypeEnum = ScreenOrientationEnum.portraitUp,
    this.isTurnOn,
    this.waitingAreaType,
    this.gender,
    this.isWeatherReq = false,
    this.isPrayerTimeReq = false,
    this.isRssFeedReq = false,
    this.qTypeEnum = QTypeEnum.appointment,
    this.screenTypeEnum = ScreenTypeEnum.waitingAreaScreen,
    this.projectID,
    this.projectLatitude,
    this.projectLongitude,
    this.cityKey,
    this.kioskQueueList,
    this.kioskLanguageConfigList,
    this.vitalSignText = "Vital Sign",
    this.doctorText = "Doctor",
    this.procedureText = "Procedure",
    this.vaccinationText = "Vaccination",
    this.nebulizationText = "Nebulization",
    this.callForVitalSignText = "Call for Vital Sign",
    this.callForDoctorText = "Call for Doctor",
    this.callForProcedureText = "Call for Procedure",
    this.callForVaccinationText = "Call for Vaccination",
    this.callForNebulizationText = "Call for Nebulization",
  });

  GlobalConfigurationsModel.fromJson({required Map<String, dynamic> json, int qType = 1, int screenType = 1}) {
    id = json['id'];
    configType = json['configType'];
    description = json['description'];
    counterStart = json['counterStart'];
    counterEnd = json['counterEnd'];
    concurrentCallDelaySec = json['concurrentCallDelaySec'] ?? 1;
    voiceType = json['voiceType'];
    voiceTypeText = json['voiceTypeText'];
    screenLanguageEnum = (json['screenLanguage'] as int).toLanguageEnum();
    screenLanguageText = json['screenLanguageText'];
    textDirection = json['textDirection'] == 2 ? TextDirection.rtl : TextDirection.ltr;
    voiceLanguageEnum = (json['voiceLanguage'] as int).toLanguageEnum();
    voiceLanguageText = json['voiceLanguageText'];
    screenMaxDisplayPatients = json['screenMaxDisplayPatients'] ?? 10;
    isNotiReq = json['isNotiReq'];
    prioritySMS = json['prioritySMS'];
    priorityWhatsApp = json['priorityWhatsApp'];
    priorityEmail = json['priorityEmail']; 
    ticketNoText = json['ticketNoText'] ?? "Ticket Number";
    postVoiceText = json['pleaseVisitCounterText'] ?? "Please Visit Counter";
    counterText = json['counterText'];
    roomText = json['roomText'];
    roomNo = json['roomNo'];
    isRoomNoRequired = json['isRoomNoReq'] ?? true;
    queueNoText = json['queueNoText'];
    callForText = json['callForText'];
    currentServeText = json['currentServeText'];
    maxText = json['maxText'] ?? "";
    minText = json['minText'] ?? "";
    nextPrayerText = json['nextPrayerText'] ?? "";
    weatherText = json['weatherText'] ?? "Weather";
    fajarText = json['fajarText'];
    dhuhrText = json['dhuhrText'];
    asarText = json['asarText'];
    maghribText = json['maghribText'];
    ishaText = json['ishaText'];
    isActive = json['isActive'];
    createdBy = json['createdBy'];
    createdOn = json['createdOn'];
    editedBy = json['editedBy'];
    editedOn = json['editedOn'];
    isToneReq = json['isToneReq'] ?? false;
    isVoiceReq = json['isVoiceReq'] ?? false;
    orientationTypeEnum = ((json['orientationType'] ?? 1) as int).toScreenOrientationEnum();
    isTurnOn = json['isTurnOn'];
    waitingAreaType = json['waitingAreaType'];
    gender = json['gender'];
    isWeatherReq = json['isWeatherReq'] ?? false;
    isPrayerTimeReq = json['isPrayerTimeReq'] ?? false;
    isRssFeedReq = json['isRssFeedReq'] ?? false;
    qTypeEnum = ((json['qType'] ?? qType) as int).toQTypeEnum();
    screenTypeEnum = ((json['screenType'] ?? screenType) as int).toScreenTypeEnum();
    projectID = json['projectID'];
    projectLatitude = json['projectLatitude'] == 0 ? 0.0 : json['projectLatitude'];
    projectLongitude = json['projectLongitude'] == 0 ? 0.0 : json['projectLongitude'];
    cityKey = json['cityKey'] ?? 0;
    if (json['kioskQueue'] != null) {
      kioskQueueList = List<KioskQueueModel>.from(json['kioskQueue'].map((kioskQueueJson) => KioskQueueModel.fromJson(kioskQueueJson)));
    } else {
      kioskQueueList = [];
    }
    if (json['kioskConfig'] != null) {
      kioskLanguageConfigList = List<KioskLanguageConfigModel>.from(json['kioskConfig'].map((kioskQueueJson) => KioskLanguageConfigModel.fromJson(kioskQueueJson)));
    } else {
      kioskLanguageConfigList = [];
    }
    vitalSignText = json['vitalSignText'];
    doctorText = json['doctorText'];
    procedureText = json['procedureText'];
    vaccinationText = json['vaccinationText'];
    nebulizationText = json['nebulizationText'];
    callForVitalSignText = json['callForVitalSignText'];
    callForDoctorText = json['callForDoctorText'];
    callForProcedureText = json['callForProcedureText'];
    callForVaccinationText = json['callForVaccinationText'];
    callForNebulizationText = json['callForNebulizationText'];
  }

  @override
  String toString() {
    return 'GlobalConfigurationsModel{id: $id, configType: $configType, description: $description, counterStart: $counterStart, counterEnd: $counterEnd, concurrentCallDelaySec: $concurrentCallDelaySec, voiceType: $voiceType, voiceTypeText: $voiceTypeText, screenLanguageEnum: $screenLanguageEnum, screenLanguageText: $screenLanguageText, textDirection: $textDirection, voiceLanguageEnum: $voiceLanguageEnum, voiceLanguageText: $voiceLanguageText, screenMaxDisplayPatients: $screenMaxDisplayPatients, isNotiReq: $isNotiReq, prioritySMS: $prioritySMS, priorityWhatsApp: $priorityWhatsApp, priorityEmail: $priorityEmail, ticketNoText: $ticketNoText, postVoiceText: $postVoiceText, roomText: $roomText, roomNo: $roomNo, isRoomNoRequired: $isRoomNoRequired, counterText: $counterText, queueNoText: $queueNoText, callForText: $callForText, currentServeText: $currentServeText, maxText: $maxText, minText: $minText, nextPrayerText: $nextPrayerText, weatherText: $weatherText, fajarText: $fajarText, dhuhrText: $dhuhrText, asarText: $asarText, maghribText: $maghribText, ishaText: $ishaText, isActive: $isActive, createdBy: $createdBy, createdOn: $createdOn, editedBy: $editedBy, editedOn: $editedOn, isToneReq: $isToneReq, isVoiceReq: $isVoiceReq, orientationTypeEnum: $orientationTypeEnum, isTurnOn: $isTurnOn, waitingAreaType: $waitingAreaType, gender: $gender, isWeatherReq: $isWeatherReq, isPrayerTimeReq: $isPrayerTimeReq, isRssFeedReq: $isRssFeedReq, qTypeEnum: $qTypeEnum, screenTypeEnum: $screenTypeEnum, projectID: $projectID, projectLatitude: $projectLatitude, projectLongitude: $projectLongitude, cityKey: $cityKey, kioskQueueList: $kioskQueueList, kioskLanguageConfigList: $kioskLanguageConfigList, vitalSignText: $vitalSignText, doctorText: $doctorText, procedureText: $procedureText, vaccinationText: $vaccinationText, nebulizationText: $nebulizationText, callForVitalSignText: $callForVitalSignText, callForDoctorText: $callForDoctorText, callForProcedureText: $callForProcedureText, callForVaccinationText: $callForVaccinationText, callForNebulizationText: $callForNebulizationText}';
  }
}

// {
//   "latitude": 24.722136,
//   "longitude": 46.774303
//  }
