export const APP_NAME = "HMall";

export const COOKIES_NAME = {
  authToken: "horys-mall-token",
  userSessionId: "horys-mall-session",
  requestUrl: "requestUrl",
  aletaPaymentToken: "aleta-payment-token",
};

export const DEFAULT_CURRENCY = "$";
export const EURO_CURRENCY = "€";

export const PLACEHOLDER_IMAGE = "/img/img-placeholder-illustration.svg";

export const PROFILE_PLACEHOLDER_IMAGE = "/img/profile-avatar.svg";

export const CROWN_IMAGE = "/img/crown.svg";

export const CATEGORY_FOR_SMART_PAY = "smart-pay";
export const CATEGORY_FOR_AI_COMPUTING = "ai-computing";
export const CATEGORY_FOR_LICENSE = "license";
export const CATEGORY_FOR_SUBSCRIPTION = "subscription";

export const MEMBERSHIP_REQUIRED_CATEGORIES = [
  "machine",
  "ai-computing",
] as const;

export const CART_STATUS = {
  checkout: "checkout",
  payment: "payment",
  shopping: "shopping",
  review: "review",
  deliveryPayment: "delivery-payment",
};
export const QUANTITY_ACTIONS: { add: string; minus: string } = {
  add: "add",
  minus: "minus",
};

export const METHOD_TO_PAY = {
  card: "card",
  card_v2: "card_v2",
  wallet: "wallet",
  aleta: "aleta",
  nowpayments: "nowpayments",
  gift: "gift",
} as const;

export type MethodToPayCode = (typeof METHOD_TO_PAY)[keyof typeof METHOD_TO_PAY];

export const ORDER_STATUS = {
  PENDING: "pending",
  PROCESSING: "processing",
  COMPLETED: "completed",
  FAILED: "failed",
  PARTIALLY_PAID: "partially-paid",
  RETURNED: "refunded",
};

export const ORDER_ITEM_STATUS = {
  PENDING: "pending",
  PURCHASED: "purchased",
  CANCELLED: "cancelled",
  FAILED: "failed",
};

export const paymentStatusTheme = {
  [ORDER_STATUS.COMPLETED]: {
    color: "green",
    className: "text-green-500 bg-green-100",
  },
  [ORDER_STATUS.PROCESSING]: {
    color: "#FA7731",
    className: "text-orange-500 bg-orange-100",
  },
  [ORDER_STATUS.PENDING]: {
    color: "#FA7731",
    className: "text-orange-500 bg-orange-100",
  },
  [ORDER_STATUS.FAILED]: {
    color: "red",
    className: "text-red-500 bg-red-100",
  },
};

export const SHIPPING_STATUS = {
  IN_HOUSE: "in-house",
  IN_PROCESS: "in-process",
  READY_FOR_SHIPPING: "ready-for-shipping",
  READY_FOR_PICKUP: "ready-for-pickup",
  DELIVERED: "delivered",
  PICKED_UP: "picked-up",
  CANCELLED: "cancelled",
  ORDER_REFUNDED: "order-refunded",
  SHIPPING_REFUNDED: "shipping-refunded",
  IN_TRANSIT: "in-transit",
  OUT_FOR_DELIVERY: "out-for-delivery",
  NO_LONGER_AVAILABLE: "no-longer-available",
  RETURNED: "returned",
  SHIPPING_NOT_PAID: "shipping_not_paid",
  SHIPPING_PAID_DELIVERED: "shipping_paid_delivered",
  SHIPPING_PAID_NOT_DELIVERED: "shipping_paid_not_delivered",
  REFUNDABLE: "refundable",
  NONE_REFUNDABLE: "none-refundable",
};

export const shippingStatusTheme = {
  [SHIPPING_STATUS.IN_HOUSE]: {
    color: "blue",
    className: "text-info-500 bg-info-100",
    label: "In House",
  },
  [SHIPPING_STATUS.RETURNED]: {
    color: "red",
    className: "text-red-500 bg-red-100",
    label: "Returned",
  },
  [ORDER_STATUS.PENDING]: {
    color: "#FA7731",
    className: "text-orange-500 bg-orange-100",
    label: "Pending",
  },
  [SHIPPING_STATUS.IN_PROCESS]: {
    color: "#FA7731",
    className: "text-orange-500 bg-orange-100",
    label: "In Process",
  },
  [SHIPPING_STATUS.READY_FOR_SHIPPING]: {
    color: "orange",
    className: "text-[#DC9700] bg-yellow-50",
    label: "Ready For Shipping",
  },
  [SHIPPING_STATUS.READY_FOR_PICKUP]: {
    color: "orange",
    className: "text-[#DC9700] bg-yellow-50",
    label: "Ready For Pickup",
  },
  [SHIPPING_STATUS.DELIVERED]: {
    color: "green",
    className: "text-green-500 bg-green-100",
    label: "Delivered",
  },
  [SHIPPING_STATUS.PICKED_UP]: {
    color: "green",
    className: "text-green-500 bg-green-100",
    label: "Picked Up",
  },
  [SHIPPING_STATUS.CANCELLED]: {
    color: "red",
    className: "text-red-500 bg-red-100",
    label: "Cancelled",
  },
  [SHIPPING_STATUS.SHIPPING_NOT_PAID]: {
    color: "red",
    className: "text-red-500 bg-red-100",
    label: "Shipping Not Paid",
  },
  [SHIPPING_STATUS.NO_LONGER_AVAILABLE]: {
    color: "red",
    className: "text-red-500 bg-red-100",
    label: "No Longer Available",
  },
  [SHIPPING_STATUS.ORDER_REFUNDED]: {
    color: "red",
    className: "text-red-500 bg-red-100",
    label: "Order Refunded",
  },
  [SHIPPING_STATUS.SHIPPING_REFUNDED]: {
    color: "red",
    className: "text-red-500 bg-red-100",
    label: "Shipping Refunded",
  },
  [SHIPPING_STATUS.OUT_FOR_DELIVERY]: {
    color: "blue",
    className: "text-info-500 bg-info-100",
    label: "Out For Delivery",
  },
  [SHIPPING_STATUS.IN_TRANSIT]: {
    color: "#FA7731",
    className: "text-orange-500 bg-orange-100",
    label: "In Transit",
  },
  [SHIPPING_STATUS.REFUNDABLE]: {
    color: "green",
    className: "text-green-500 bg-green-100",
    label: "Refundable",
  },
  [SHIPPING_STATUS.NONE_REFUNDABLE]: {
    color: "red",
    className: "text-red-500 bg-red-100",
    label: "Non-Refundable",
  },
  [SHIPPING_STATUS.SHIPPING_PAID_DELIVERED]: {
    color: "green",
    className: "text-green-500 bg-green-100",
    label: "Shipping Paid Delivered",
  },
  [SHIPPING_STATUS.SHIPPING_PAID_NOT_DELIVERED]: {
    color: "orange",
    className: "text-[#DC9700] bg-yellow-50",
    label: "Shipping Paid Not Delivered",
  },
  default: {
    color: "green",
    className: "text-green-500 bg-green-100",
    label: "Purchased",
  },
};

export const APP_LANG = ["en", "it"];
export const SHIPPING_CART_STATUS = {
  initiateDelivery: "initiate_delivery",
  methods: "delivery-mode",
  payments: "payment",
  review: "review",
  deliveryConfirmation: "shipping_delivery_confirmation",
};

export const UPGRADE_STATUS = {
  upgradeProduct: "upgrade_product",
  methods: "checkout",
  payments: "payment",
  review: "review",
  deliveryConfirmation: "upgrade_delivery_confirmation",
};

export const SHIPPING_METHOD = {
  shipping: {
    value: "shipping",
    label: "Shipping",
  },
  pickup: {
    value: "pickup",
    label: "Pickup",
  },
};
export const GREETING_DIALOG_STATUS_KEY = "greetingPopupSeen";
export const GREETING_DIALOG_STATUS = {
  seen: "seen",
  unSeen: "unSeen",
};

export const SHIPPING_ORDER_ID_KEY = "shippingOrderIdKey";
export const SMART_PAY_PARTIAL_PAY_SUCCESS = "SmartPayPartialPaySuccess";
export const SMART_PAY_PARTIAL_PAY_SUCCESS_VALUE = {
  SUCCESS: "success",
  FAILED: "failed",
};

export const ADDRESS_TYPES = {
  shipping: {
    value: "shipping",
    label: "Shipping",
  },
  billing: {
    value: "billing",
    label: "Billing",
  },
};

export const SMLYK = {
  value: "smLYK",
  label: "smLYK",
};

export const CASHBACK_TOKEN = new Proxy(
  {
    mlykgen3cashback: { value: "mlyk", label: "mlyk" },
    smlykgen3cashback: { value: "smlyk", label: "smlyk" },
    usdkgen3cashback: { value: "usdk", label: "usdk-old" },
    mlyk: { value: "mlyk", label: "mlyk" },
  },
  {
    get: (target, prop) => {
      return (
        target[prop as keyof typeof target] ?? {
          value: prop,
          label: prop,
        }
      );
    },
  },
);

export const ORDERS_TABLE_DEFAULTS = {
  page: 1,
  limit: 15,
};

export const SHIPPING_ORDERS_TABLE_DEFAULTS = {
  page: 1,
  limit: 15,
};

export const LEGACY_ORDERS_TABLE_DEFAULTS = {
  page: 1,
  limit: 15,
};

export const KYC_STATUS = {
  SUBSCRIPTION_REQUIRED: "subscription-required",
  KYC_REQUIRED: "kyc-required",
  KYC_PENDING: "kyc-pending",
  KYC_REJECTED: "kyc-rejected",
  ACTIVE: "active",
} as const;

export const MIGRATION_ORDER_ID_KEY = "migrationOrderIdKey";

export const MIGRATE_STATUS = {
  methods: "checkout",
  payments: "payment",
  review: "review",
  deliveryConfirmation: "migrate_delivery_confirmation",
};

export const EXTENSIONS_STATUS = {
  methods: "checkout",
  payments: "payment",
  review: "review",
  deliveryConfirmation: "migrate_delivery_confirmation",
};

export const GEN_3_EXTENSION_HOME_DIALOG_STATUS_KEY =
  "gen3ExtensionHomeDialogSeen";

export const PAYMENTS_TYPE = {
  UPGRADE: "upgrade",
  gen2Migration: "gen2Migration",
  NORMAL: "normal",
  SHIPPING: "shipping",
  SMART_PAY: "smart-pay",
};
