import 'dart:ui';
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.lab;
  ScreenTypeEnum screenTypeEnum = ScreenTypeEnum.waitingAreaScreen;
  int? projectID;
  double? projectLatitude;
  double? projectLongitude;
  int? cityKey;
  List<KioskQueueModel>? kioskQueueList;

  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.lab,
    this.screenTypeEnum = ScreenTypeEnum.waitingAreaScreen,
    this.projectID,
    this.projectLatitude,
    this.projectLongitude,
    this.cityKey,
    this.kioskQueueList,
  });

  GlobalConfigurationsModel.fromJson(Map<String, dynamic> json) {
    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['isRoomNoRequired'] ?? 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;
    // isToneReq = true;
    // isVoiceReq = true;
    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'] as int).toQTypeEnum();
    screenTypeEnum = (json['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'];
    if (json['kioskQueue'] != null) {
      kioskQueueList = List<KioskQueueModel>.from(json['kioskQueue'].map((kioskQueueJson) => KioskQueueModel.fromJson(kioskQueueJson)));
    }
  }
}

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