import HomeIcon from "../assets/icons/home.svg";
import HomeIconFilled from "../assets/icons/home-filled.svg";
import PaymentsIcon from "../assets/icons/payments.svg";
import PaymentsIconFilled from "../assets/icons/payments-filled.svg";
import ServiceIcon from "../assets/icons/service.svg";
import ServiceIconFilled from "../assets/icons/service-filled.svg";
import BatteryIcon from "../assets/icons/battery.svg";
import BatteryIconFilled from "../assets/icons/battery-filled.svg";
import InfoIcon from "../assets/icons/error.svg";
import WarningIcon from "../assets/icons/warning.svg";
import DangerIcon from "../assets/icons/danger.svg";
import type { BmsState } from "./types";
import { useTranslation } from "react-i18next";

export const BASE_URL = "https://dev-driver-saathi-api.vecmocon.com";
export const PAYMENT_SOCKET_BASE_URL =
  "wss://dev-driver-saathi-api.vecmocon.com";
// export const BASE_URL = "https://46fa2cacfc37.ngrok-free.app";

// const SERVER_URL =
// "http://dev.vec-tr.ai:8089/?dashboardId=deviceDashboardSocket&assetId=V16000868651064644504";
export const VECTOR_BASE_URL = "https://vec-tr.ai";
export const SOCKET_BASE_URL = "wss://vec-tr.ai";

export const STORAGE_KEYS = {
  LANGUAGE: "userLanguage",
  AUTH_TOKEN: "authToken",
  THEME: "appTheme",
};

export const APP_CONFIG = {
  DEFAULT_LANGUAGE: "en",
  SUPPORTED_LANGUAGES: ["en", "hi"],
};

export const useTabConfig = () => {
  const { t } = useTranslation();

  return [
    {
      name: "index",
      title: t("navigation.home"),
      Icon: HomeIcon,
      IconFilled: HomeIconFilled,
      path: "/",
    },
    {
      name: "payments",
      title: t("navigation.payments"),
      Icon: PaymentsIcon,
      IconFilled: PaymentsIconFilled,
      path: "/payments",
    },
    {
      name: "service",
      title: t("navigation.service"),
      Icon: ServiceIcon,
      IconFilled: ServiceIconFilled,
      path: "/service",
    },
    {
      name: "my-battery",
      title: t("navigation.my-battery"),
      Icon: BatteryIcon,
      IconFilled: BatteryIconFilled,
      path: "/my-battery",
    },
  ];
};

export const MESSAGES = {
  AUTHENTICATION: {
    INVALID_TOKEN: "Invalid Token",
    VERIFICATION_FAILED: "Verification failed, try again later",
  },
};

export const ALERT_STYLES = {
  info: {
    backgroundColor: "#E5EBFD",
    icon: InfoIcon,
  },
  warning: {
    backgroundColor: "#FFF2E2",
    icon: WarningIcon,
  },
  danger: {
    backgroundColor: "#FFE9E9",
    icon: DangerIcon,
  },
};

export const SUPPORT = {
  WHATSAPP_NUMBER: "918685846459",
  WHATSAPP_PLACEHOLDER: "Hi, I need help regarding my vehicle.",
  PHONE: "+911234567890",
  EMAIL: "support@vecmocon.com",
  EMAIL_SUBJECT: "Support Request",
  EMAIL_BODY: "Hello,\n\nI need assistance with...",
};

export const USER_PROFILE = {
  MAX_IMAGE_SIZE_IN_MB: 5,
};

export const BMS_STATE_LABELS: Record<BmsState, string> = {
  0: "Idle",
  1: "Charging",
  [-1]: "Discharging",
};

export const AWS = {
  BUCKET_NAME: "battery-as-a-service",
  REGION: "us-east-1",
};

export const issueConfig = [
  {
    category: "Physical Damage",
    options: [
      { label: "Top cover crack/damage", value: "top_cover_damage" },
      { label: "Chogori connector damage", value: "chogori_connector_damage" },
      { label: "Flip handle damage/missing", value: "flip_handle_damage" },
      {
        label: "Handle gripper damage/missing",
        value: "handle_gripper_damage",
      },
      { label: "TCU cover damage", value: "tcu_cover_damage" },
      { label: "Gore Vent damage", value: "gore_vent_damage" },
    ],
  },
  {
    category: "Water Ingress Issues",
    options: [
      { label: "BMS water ingress", value: "bms_water_ingress" },
      { label: "SD card water ingress", value: "sd_card_water_ingress" },
      { label: "Cell pack water ingress", value: "cell_pack_water_ingress" },
      {
        label: "Battery completely submerged in water",
        value: "battery_submerged",
      },
    ],
  },
  {
    category: "Electrical & Functional Failures",
    options: [
      { label: "BMS failure/card burnt", value: "bms_failure" },
      {
        label: "SD card failure/data unable to copy/SD card not detected",
        value: "sd_card_failure",
      },
      { label: "Deep discharge (DD)", value: "deep_discharge" },
      { label: "Cell imbalance", value: "cell_imbalance" },
      { label: "CT sensing faulty", value: "ct_sensing_faulty" },
      { label: "TCU hang", value: "tcu_hang" },
    ],
  },
  {
    category: "Alarms & Warnings",
    options: [
      { label: "UV1, UV2 alarms (Under Voltage)", value: "uv1_uv2_alarm" },
      { label: "EOD (End of Discharge)", value: "eod_alarm" },
      {
        label: "Charge & discharge OT (Over Temperature) alarm",
        value: "ot_alarm",
      },
    ],
  },
  {
    category: "Other Issues",
    options: [
      { label: "BMS full dust formed", value: "bms_dust" },
      { label: "NFF (No Fault Found)", value: "nff" },
      {
        label: "Under warranty (not an issue, but listed in data)",
        value: "under_warranty",
      },
      { label: "NA (Not Applicable)", value: "not_applicable" },
    ],
  },
];

export const payments = {
  MIN_AMOUNT: 1,
  LINK_EXPIRED: "Payment link expired",
};
