import 'package:flutter/material.dart';
import 'package:logger/logger.dart';

bool useTestIP = false;
Logger logger = Logger(printer: PrettyPrinter(printEmojis: false, colors: true, dateTimeFormat: DateTimeFormat.none));

// app globals

bool isNeedToBreakVoiceForArabic = true;
bool isSpeechCompleted = true;

class AppStrings {
  static String poweredBy = "Powered By";
  static String appName = "QLine";
  static String fontNamePoppins = "Poppins";
  static String fontNameCairo = "Cairo";
  static String noInternetConnection = "No Internet Connection";
  static String awaitingArrivalEng = "Awaiting Patients Arrival";
  static String awaitingQueueNumberEng = "Awaiting Queue Number";
  static String awaitingQueueNumberAr = "في انتظار رقم قائمة الانتظار";
  static String counterNo = "Counter Number: ";
  static String awaitingArrivalAr = "في انتظار وصول المرضى";
  static String configurationIssueContactAdmin = "There is something wrong with configuration. Please contact Admin.";
}

class AppColors {
  //TextColors
  static Color greyColor = const Color(0xFF2B353E);
  static Color darkGreyColor = const Color(0x3A1E2326);
  static Color blueColor = const Color(0xFF3C86D0);
  static Color redColor = Colors.red;
  static Color greenColor = Colors.green;
  static Color whiteColor = Colors.white;
  static Color yellowColor = const Color(0xFFC99609);
  static Color brownColor = const Color(0xFF460707);
  static Color blackColor = Colors.black;

  static Color nebulizationColor = const Color(0xFF3C86D0);
  static Color vitalSignColor = const Color(0xFFD02127);
  static Color doctorColor = const Color(0xFF52964F);
  static Color vaccinationColor = const Color(0xFFC99609);
  static Color procedureColor = const Color(0xFF460707);

  //Decoration

  static BoxDecoration configWidgetDecoration = BoxDecoration(
    color: Colors.white,
    borderRadius: BorderRadius.circular(12),
    boxShadow: [
      BoxShadow(
        color: Colors.grey.withOpacity(0.2),
        blurRadius: 4,
        offset: const Offset(4, 4), // Shadow position
      ),
      BoxShadow(
        color: Colors.grey.withOpacity(0.2),
        blurRadius: 4,
        offset: const Offset(-4, -4), // Shadow position
      ),
    ],
  );
}

class AppAssets {
  static String poppinsMedium = "assets/fonts/Poppins/Poppins-Medium.ttf";

  static String hmgLogo = "assets/images/hmglogo.svg";
  static String hmgLogoPharmacy = "assets/images/hmglogo_pharmacy.svg";
  static String noInternetImage = "assets/images/undraw_connected_world_wuay.png";
  static String cloudLogo = "assets/images/cloud_logo.png";
  static String languageIcon = "assets/images/language_icon.svg";
  static String kioskQueueIcon = "assets/images/kiosk_queue_icon.svg";

  //IconPaths
  static String vitalSignIcon = "assets/images/vitalsign_icon.svg";
  static String nebulizationIcon = "assets/images/nebulization_icon.svg";
  static String doctorIcon = "assets/images/doctor_icon.svg";
  static String procedureIcon = "assets/images/procedure_icon.svg";
  static String vaccinationIcon = "assets/images/vaccination_icon.svg";

  //Widgets
  static String mosqueIcon = "assets/icons/mosque.svg";
  static String weatherIcon = "assets/icons/weather.svg";

  static String cloudIcon = "assets/icons/cloudy.svg";
  static String coldIcon = "assets/icons/cold.svg";
  static String hotIcon = "assets/icons/hot.svg";
  static String rainIcon = "assets/icons/rainy.svg";
  static String sunnyIcon = "assets/icons/sunny.svg";
  static String windIcon = "assets/icons/windy.svg";

  //Tones
  static String callTone = "assets/tones/call_tone.mp3";
}

class AppConstants {
  static int maxSmallScreen = 660;
  static String onlyNumbers = "[0-9]";
  static String onlyLetters = "[a-zA-Z &'\"]";
  static String onlyDate = "[0-9/]";
  static String apiKey = 'EE17D21C7943485D9780223CCE55DCE5';
  static String testIP = '12.4.5.1'; // projectID.QlineType.ScreenType.AnyNumber (1 to 10)
  static int thresholdForListUI = 3;

  static int currentBuildVersion = 6;
}

class ApiConstants {
  static String baseUrlLive = 'https://qline.hmg.com'; // LIVE
  static String baseUrlUat = 'https://ms.hmg.com/nscapi'; // UAT
  static String baseUrlDev = 'https://ms.hmg.com/nscapi2'; // DEV

  static String baseUrl = baseUrlLive;
  static String baseUrlHub = '$baseUrl/PatientCallingHub';
  static String baseUrlApi = '$baseUrl/api';
  static String baseUrlApiGen = '$baseUrl/api/Gen';

  static String baseUrlApiPatientCall = '$baseUrlApi/PatientCall';
  static String createTicket = '$baseUrlApiPatientCall/LAB_PatientCallNo_Get';
  static String commonConfigGet = '$baseUrlApiPatientCall/Common_Config_GetByIP';
  static String waitingAreaScreenConfigGet = '$baseUrlApiPatientCall/WaitingAreaScreen_Config_Get';
  static String rssFeedGet = '$baseUrlApiPatientCall/RssFeed_Get';
  static String getWeatherForecastBy5Days = "$baseUrlApiPatientCall/WeatherForecast_GetBy5Days";
  static String prayerTimeToday = "$baseUrlApiPatientCall/PrayerTime_Today";

  //Generic
  static String createTicketForKiosk = '$baseUrlApiGen/GEN_PatientCallNo_Get';
  static String ticketAcknowledgementInsert = '$baseUrlApi/Common/TicketQueueAck_Insert';

  // AppointmentSpecific

  static String ticketCallRequestUpdate = "$baseUrlApiPatientCall/CallRequest_QueueUpdate";

  // Signal R Constants

  static String sendQLinePatientCall = "SendQLinePatientCall";
  static String sendQLineConfig = "SendQLineConfig";
}

class CacheConstants {
  static String lastTimeUpdated = "lastTimeUpdated";
}

// calling for pharmacy

// {
// "projectID": 12,
// "counterNo": 1,
// "queueID": 11,
// "isVidaPlus": false,
// "editedBy": 102,
// "apiKey": "EE17D21C7943485D9780223CCE55DCE5"
// }

// calling for RAD
//{
//   "projectID": 12,
//   "patientID": 0,
//   "orderNo": "12",
//   "invoiceNo": "12",
//   "isVip": true,
//   "isVidaPlus": false,
//   "createdBy": 101,
//   "apiKey": "EE17D21C7943485D9780223CCE55DCE5"
// }

class MockJsonRepo {
  static Map<String, Object> globalConfigurationMockResponse = {
    "id": 1,
    "configType": 2,
    "description": "Main Kiosk Config",
    "counterStart": 1,
    "counterEnd": 10,
    "concurrentCallDelaySec": 5,
    "voiceType": 1,
    "voiceTypeText": "Standard Voice",
    "screenLanguage": 1,
    "screenLanguageText": "English",
    "textDirection": 1,
    "voiceLanguage": 1,
    "voiceLanguageText": "English",
    "screenMaxDisplayPatients": 8,
    "isNotiReq": true,
    "prioritySMS": 1,
    "priorityWhatsApp": 2,
    "priorityEmail": 3,
    "ticketNoText": "Ticket Number",
    "pleaseVisitCounterText": "Please Visit Counter",
    "counterText": "Counter",
    "roomText": "Room",
    "roomNo": 101,
    "isRoomNoRequired": true,
    "queueNoText": "Queue Number",
    "callForText": "Call For",
    "currentServeText": "Current Serve",
    "maxText": "Max Temp",
    "minText": "Min Temp",
    "nextPrayerText": "Next Prayer",
    "weatherText": "Weather",
    "fajarText": "Fajar",
    "dhuhrText": "Dhuhr",
    "asarText": "Asar",
    "maghribText": "Maghrib",
    "ishaText": "Isha",
    "isActive": true,
    "createdBy": 101,
    "createdOn": "2025-07-15T08:00:00Z",
    "editedBy": 102,
    "editedOn": "2025-07-15T10:00:00Z",
    "isToneReq": false,
    "isVoiceReq": false,
    "orientationType": 1,
    "isTurnOn": true,
    "waitingAreaType": 1,
    "gender": 1,
    "isWeatherReq": true,
    "isPrayerTimeReq": true,
    "isRssFeedReq": true,
    "qType": 1,
    "screenType": 1,
    "projectID": 123,
    "projectLatitude": 24.722136,
    "projectLongitude": 46.774303,
    "cityKey": 999,
    "kioskQueue": [
      {"id": 1, "name": "General Queue", "code": "GQ", "isActive": true},
      {"id": 2, "name": "VIP Queue", "code": "VIP", "isActive": true}
    ],
    "kioskConfig": [
      {"id": 1, "languageCode": "en", "languageName": "English", "isDefault": true},
      {"id": 2, "languageCode": "ar", "languageName": "Arabic", "isDefault": false}
    ]
  };

  static List<Map<String, Object>> mockPatientTicketResponse = [
    {
      "qType": 1,
      "screenType": 2,
      "connectionID": "abc-123-connection",
      "data": [
        {
          "id": 101,
          "patientID": 202,
          "laB_QGroupID": 303,
          "queueNo": "A13",
          "counterBatchNo": 1,
          "calledBy": 404,
          "calledOn": "2025-07-15T08:30:00Z",
          "servedOn": "2025-07-15T08:45:00Z",
          "patientName": "John Doe",
          "mobileNo": "+966500000000",
          "patientEmail": "john@example.com",
          "preferredLang": 1,
          "ticketNoText": "Ticket No",
          "pleaseVisitCounterText": "Please Visit Counter",
          "patientGender": 1,
          "roomNo": "R2",
          "isActive": true,
          "createdBy": 999,
          "editedBy": 1000,
          "editedOn": "2025-07-15T08:10:00Z",
          "createdOn": "2025-07-15T08:00:00Z",
          "doctorNameN": "Dr. Smith",
          "callType": 2,
          "queueNoM": "B45",
          "callNoStr": "Call #1001",
          "isQueue": true,
          "isToneReq": true,
          "isVoiceReq": true,
          "orientationType": 1,
          "isTurnOn": true,
          "concurrentCallDelaySec": 3,
          "crTypeAckIP": "192.168.1.100",
          "voiceLanguage": 1,
          "voiceLanguageText": "English",
          "vitalSignText": "Vital Sign",
          "doctorText": "Doctor",
          "procedureText": "Procedure",
          "vaccinationText": "Vaccination",
          "nebulizationText": "Nebulization",
          "callForVitalSignText": "Calling for Vital Sign",
          "callForDoctorText": "Calling for Doctor",
          "callForProcedureText": "Calling for Procedure",
          "callForVaccinationText": "Calling for Vaccination",
          "callForNebulizationText": "Calling for Nebulization",
          "roomText": "Room",
          "queueNoText": "Queue No",
          "callForText": "Call For"
        },
        {
          "id": 101,
          "patientID": 202,
          "laB_QGroupID": 303,
          "queueNo": "B21",
          "counterBatchNo": 1,
          "calledBy": 404,
          "calledOn": "2025-07-15T08:30:00Z",
          "servedOn": "2025-07-15T08:45:00Z",
          "patientName": "John Doe",
          "mobileNo": "+966500000000",
          "patientEmail": "john@example.com",
          "preferredLang": 1,
          "ticketNoText": "Ticket No",
          "pleaseVisitCounterText": "Please Visit Counter",
          "patientGender": 1,
          "roomNo": "R3",
          "isActive": true,
          "createdBy": 999,
          "editedBy": 1000,
          "editedOn": "2025-07-15T08:10:00Z",
          "createdOn": "2025-07-15T08:00:00Z",
          "doctorNameN": "Dr. Smith",
          "callType": 3,
          "queueNoM": "B45",
          "callNoStr": "Call #1001",
          "isQueue": true,
          "isToneReq": true,
          "isVoiceReq": true,
          "orientationType": 1,
          "isTurnOn": true,
          "concurrentCallDelaySec": 3,
          "crTypeAckIP": "192.168.1.100",
          "voiceLanguage": 1,
          "voiceLanguageText": "English",
          "vitalSignText": "Vital Sign",
          "doctorText": "Doctor",
          "procedureText": "Procedure",
          "vaccinationText": "Vaccination",
          "nebulizationText": "Nebulization",
          "callForVitalSignText": "Calling for Vital Sign",
          "callForDoctorText": "Calling for Doctor",
          "callForProcedureText": "Calling for Procedure",
          "callForVaccinationText": "Calling for Vaccination",
          "callForNebulizationText": "Calling for Nebulization",
          "roomText": "Room",
          "queueNoText": "Queue No",
          "callForText": "Call For"
        },
        {
          "id": 101,
          "patientID": 202,
          "laB_QGroupID": 303,
          "queueNo": "C07",
          "counterBatchNo": 1,
          "calledBy": 404,
          "calledOn": "2025-07-15T08:30:00Z",
          "servedOn": "2025-07-15T08:45:00Z",
          "patientName": "John Doe",
          "mobileNo": "+966500000000",
          "patientEmail": "john@example.com",
          "preferredLang": 1,
          "ticketNoText": "Ticket No",
          "pleaseVisitCounterText": "Please Visit Counter",
          "patientGender": 1,
          "roomNo": "R4",
          "isActive": true,
          "createdBy": 999,
          "editedBy": 1000,
          "editedOn": "2025-07-15T08:10:00Z",
          "createdOn": "2025-07-15T08:00:00Z",
          "doctorNameN": "Dr. Smith",
          "callType": 4,
          "queueNoM": "B45",
          "callNoStr": "Call #1001",
          "isQueue": true,
          "isToneReq": true,
          "isVoiceReq": true,
          "orientationType": 1,
          "isTurnOn": true,
          "concurrentCallDelaySec": 3,
          "crTypeAckIP": "192.168.1.100",
          "voiceLanguage": 1,
          "voiceLanguageText": "English",
          "vitalSignText": "Vital Sign",
          "doctorText": "Doctor",
          "procedureText": "Procedure",
          "vaccinationText": "Vaccination",
          "nebulizationText": "Nebulization",
          "callForVitalSignText": "Calling for Vital Sign",
          "callForDoctorText": "Calling for Doctor",
          "callForProcedureText": "Calling for Procedure",
          "callForVaccinationText": "Calling for Vaccination",
          "callForNebulizationText": "Calling for Nebulization",
          "roomText": "Room",
          "queueNoText": "Queue No",
          "callForText": "Call For"
        },
        {
          "id": 101,
          "patientID": 202,
          "laB_QGroupID": 303,
          "queueNo": "D11",
          "counterBatchNo": 1,
          "calledBy": 404,
          "calledOn": "2025-07-15T08:30:00Z",
          "servedOn": "2025-07-15T08:45:00Z",
          "patientName": "John Doe",
          "mobileNo": "+966500000000",
          "patientEmail": "john@example.com",
          "preferredLang": 1,
          "ticketNoText": "Ticket No",
          "pleaseVisitCounterText": "Please Visit Counter",
          "patientGender": 1,
          "roomNo": "R5",
          "isActive": true,
          "createdBy": 999,
          "editedBy": 1000,
          "editedOn": "2025-07-15T08:10:00Z",
          "createdOn": "2025-07-15T08:00:00Z",
          "doctorNameN": "Dr. Smith",
          "callType": 5,
          "queueNoM": "B45",
          "callNoStr": "Call #1001",
          "isQueue": true,
          "isToneReq": true,
          "isVoiceReq": true,
          "orientationType": 1,
          "isTurnOn": true,
          "concurrentCallDelaySec": 3,
          "crTypeAckIP": "192.168.1.100",
          "voiceLanguage": 1,
          "voiceLanguageText": "English",
          "vitalSignText": "Vital Sign",
          "doctorText": "Doctor",
          "procedureText": "Procedure",
          "vaccinationText": "Vaccination",
          "nebulizationText": "Nebulization",
          "callForVitalSignText": "Calling for Vital Sign",
          "callForDoctorText": "Calling for Doctor",
          "callForProcedureText": "Calling for Procedure",
          "callForVaccinationText": "Calling for Vaccination",
          "callForNebulizationText": "Calling for Nebulization",
          "roomText": "Room",
          "queueNoText": "Queue No",
          "callForText": "Call For"
        },
        {
          "id": 101,
          "patientID": 202,
          "laB_QGroupID": 303,
          "queueNo": "E20",
          "counterBatchNo": 1,
          "calledBy": 404,
          "calledOn": "2025-07-15T08:30:00Z",
          "servedOn": "2025-07-15T08:45:00Z",
          "patientName": "John Doe",
          "mobileNo": "+966500000000",
          "patientEmail": "john@example.com",
          "preferredLang": 1,
          "ticketNoText": "Ticket No",
          "pleaseVisitCounterText": "Please Visit Counter",
          "patientGender": 1,
          "roomNo": "R6",
          "isActive": true,
          "createdBy": 999,
          "editedBy": 1000,
          "editedOn": "2025-07-15T08:10:00Z",
          "createdOn": "2025-07-15T08:00:00Z",
          "doctorNameN": "Dr. Smith",
          "callType": 6,
          "queueNoM": "B45",
          "callNoStr": "Call #1001",
          "isQueue": true,
          "isToneReq": true,
          "isVoiceReq": true,
          "orientationType": 1,
          "isTurnOn": true,
          "concurrentCallDelaySec": 3,
          "crTypeAckIP": "192.168.1.100",
          "voiceLanguage": 1,
          "voiceLanguageText": "English",
          "vitalSignText": "Vital Sign",
          "doctorText": "Doctor",
          "procedureText": "Procedure",
          "vaccinationText": "Vaccination",
          "nebulizationText": "Nebulization",
          "callForVitalSignText": "Calling for Vital Sign",
          "callForDoctorText": "Calling for Doctor",
          "callForProcedureText": "Calling for Procedure",
          "callForVaccinationText": "Calling for Vaccination",
          "callForNebulizationText": "Calling for Nebulization",
          "roomText": "Room",
          "queueNoText": "Queue No",
          "callForText": "Call For"
        }
      ]
    }
  ];
}

// RAW DATA:
