import 'package:flutter/material.dart';
import 'package:hmg_qline/models/ticket_model.dart';
import 'package:hmg_qline/utilities/enums.dart';

bool useTestIP = false;

// app globals

bool isNeedToBreakVoiceForArabic = true;
bool isSpeechCompleted = true;

class AppStrings {
  static String timeRemainingText = "Time Remaining";
  static String namazTimeText = "Namaz Time";

  static String poweredBy = "Powered By";
  static String appName = "QLine";
  static String fontNamePoppins = "Poppins";
  static String fontNameGesTwo = "GE_SS_Two";
  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 IT Support.";

  static String dataLogsFileName = "data_logs.txt";
  static String errorLogsFileName = "error_logs.txt";
  static String connectivityLogsFileName = "connectivity_logs.txt";

  static String openAppNativeFunctionName = "reopenApp";

  static List<String> prayersArray = ["الفجر", "الظهر", "العصر", "المغرب", "العشاء"];

  static String dummyRssFeedText =
      "Latest News: Hospital announces new specialized cardiac unit opening next month • Health Update: Annual flu vaccination campaign starts Monday at all locations • Service Notice: Pharmacy hours extended until 10 PM on weekdays • Patient Advisory: New mobile app available for appointment booking and lab results • Emergency Drill: Fire safety exercise scheduled for 2 PM today • Visitor Information: Updated visiting hours now 8 AM to 8 PM daily • Maintenance Alert: Elevator B will be out of service from 6-8 AM tomorrow • Staff Recognition: Dr. Sarah Ahmed receives excellence award for patient care • Technology Update: New digital check-in kiosks now available in main lobby • Weather Advisory: Heavy rain expected - please allow extra travel time";

  static String thankYouMessageAr = "نشكر لكم صبركم، ونتمنى لكم دوام الصحة والعافية";
  static String thankYouMessageEn = "Thank you for your patience, we wish you good health and wellness";
}

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
      ),
    ],
  );

  // New Design Colors

  static Color backgroundColor = const Color(0xFFF7F7F7);
  static Color greyTextColor = const Color(0xFF3E3C47);
  static Color darkGreyTextColor = const Color(0xFF2B353E);
  static Color greyContainerColor = const Color(0xFF4B5B6A);
  static Color newGreenColor = const Color(0xFF03A567);
  static Color newRedColor = const Color(0xFFEC1C2B);
  static Color newRedColorWithLessOpacity = const Color(0x33FF0000);
  static Color lightBorderColor = const Color(0xFFEDEDED);

  static Color newVitalSignColor = greyContainerColor;
  static Color newDoctorColor = newGreenColor;

  // Custom Shadow Container Colors
  static Color smoothContainerShadow = const Color(0x14000000); // 8% black without opacity

  static List<Color> gradientBorderComboForVitalSigns = [
    const Color(0xFFFFFFFF), // start
    const Color(0xFFAFEAD4), // start
    const Color(0xFF42BB8D), // end
    const Color(0xFF42BB8D), // base color
  ];

  static List<Color> gradientBorderComboForDoctor = [
    const Color(0xFFFFFFFF), // start
    const Color(0xFFF2F3F4),
    const Color(0xFFA5ADB4),
    const Color(0xFF78848F),
  ];
}

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 doctorIcon = "assets/images/doctor_icon.svg";
  static String nebulizationIcon = "assets/images/nebulization_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 cloudyLeftIcon = "assets/new_design_icons/weather_icons/cloudy_left_icon.svg";
  static String coldLeftIcon = "assets/new_design_icons/weather_icons/cold_left_icon.svg";
  static String hotLeftIcon = "assets/new_design_icons/weather_icons/hot_left_icon.svg";
  static String rainyLeftIcon = "assets/new_design_icons/weather_icons/rainy_left_icon.svg";
  static String sunnyLeftIcon = "assets/new_design_icons/weather_icons/sunny_left_icon.svg";
  static String windyLeftIcon = "assets/new_design_icons/weather_icons/windy_left_icon.svg";

  static String cloudyRightIcon = "assets/new_design_icons/weather_icons/cloudy_right_icon.svg";
  static String coldRightIcon = "assets/new_design_icons/weather_icons/cold_right_icon.svg";
  static String hotRightIcon = "assets/new_design_icons/weather_icons/hot_right_icon.svg";
  static String rainyRightIcon = "assets/new_design_icons/weather_icons/rainy_right_icon.svg";
  static String sunnyRightIcon = "assets/new_design_icons/weather_icons/sunny_right_icon.svg";
  static String windyRightIcon = "assets/new_design_icons/weather_icons/windy_right_icon.svg";

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

  // New Design Icons
  static String hmgLogoPatternLightIcon = "assets/new_design_icons/hmg_logo_pattern_light.svg";
  static String hmgLogoPatternDarkIcon = "assets/new_design_icons/hmg_logo_pattern_dark.svg";
  static String salahTimeIcon = "assets/new_design_icons/salah_time_icon.svg";
  static String hmgLogoFull = "assets/new_design_icons/hmg_logo_full.svg";
  static String cloudSolutionsLogo = "assets/new_design_icons/cloud_solutions_logo.svg";

  static String newVitalSignIcon = "assets/images/vitalsign_icon.svg";
  static String newDoctorIcon = "assets/images/doctor_icon.svg";
  static String textBgLeaf = "assets/new_design_icons/text_bg_leaf.svg";
  static String labIcon = "assets/new_design_icons/lab_icon.svg";
}

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 = 5;
  static double currentBuildVersion = 9.4;
  static double clearLogsHoursThreshold = 48;

  // Maximum log file size in bytes before rotation/clearing. Default 2 MB.
  static int maxLogFileSizeBytes = 2 * 1024 * 1024;

  // Takhasusi Main Branch IPs - These devices use getTurnsByOrientationForOlderVersions()
  static const List<String> takhasusiMainBranchIps = [
    '10.70.194.87',
    '10.70.6.139',
    '10.70.6.141',
    '10.70.6.142',
    '10.70.6.114',
    '10.70.6.143',
    '10.70.6.49',
    '10.70.6.56',
    '10.70.6.144',
    '10.70.6.158',
    '10.70.6.119',
    '10.70.6.156',
    '10.70.6.109',
    '10.70.6.102',
    '10.70.6.107',
    '10.70.6.137',
    '10.70.6.93',
    '10.70.6.147',
    '10.70.6.148',
    '10.70.6.98',
    '10.70.6.112',
    '10.70.6.96',
    '10.70.6.145',
    '10.70.6.91',
    '10.70.6.157',
  ];
}

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 baseUrl = baseUrlDev;
  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";
  static String logLastCleared = "log_last_cleared";
}

// 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 TicketData ticket = TicketData(
    id: 189805,
    patientID: 4292695,
    queueNo: 'W-T-4',
    mobileNo: '0598544522',
    patientEmail: 'munira.ali@hotmail.com',
    preferredLang: 2,
    voiceLanguageEnum: LanguageEnum.english,
    ticketNoText: 'Ticket Number',
    postVoiceText: 'Call for Vital Signs',
    patientGender: 2,
    roomNo: 'D 12',
    editedOn: DateTime.parse('2025-08-18 15:09:03.633'),
    createdOn: DateTime.parse('2025-08-18 15:06:07.363'),
    callTypeEnum: CallTypeEnum.doctor,
    queueNoM: 'W-T-4',
    callNoStr: 'W_T-4',
    isQueue: false,
    isToneReq: false,
    isVoiceReq: false,
    orientationType: 0,
    isTurnOn: false,
    concurrentCallDelaySec: 0,
    voiceLanguageText: 'English',
    vitalSignText: 'علامة حيوية',
    doctorText: 'الطبيب',
    procedureText: 'الاجراءات',
    vaccinationText: 'المطاعيم',
    nebulizationText: 'التنفس',
    callForVitalSignText: 'التوجه الى غرفة قياس العلامات الحيوية',
    callForDoctorText: 'التوجه الى الطبيب',
    callForProcedureText: 'التوجه الى غرفة الإجراءات',
    callForVaccinationText: 'التوجه الى غرفة المطاعيم',
    callForNebulizationText: 'التوجه الى غرفة التنفس',
    roomText: 'غرفة',
    queueNoText: 'رقم الانتظار',
    callForText: 'التوجه الى',
  );
}

// RAW DATA:
