import { t } from "i18next";

export const BASE_URL = "https://dev.fascano.com/api/user_app/";
export const default_image = "/default.png";
export const FilterBaseFromDate = "2020-01-01";

const ROOTS_DEFAULT = "";
const ROOTS_AUTH = "/auth";
const ROOTS_ERRORS = "/errors";

export const PATH_AUTH = {
  root: ROOTS_AUTH,
  login: path(ROOTS_AUTH, "/login"),
  signin: path(ROOTS_AUTH, "/signin"),
  signup: path(ROOTS_AUTH, "/signup"),
  passwordReset: path(ROOTS_AUTH, "/password-reset"),
  passwordConfirm: path(ROOTS_AUTH, "/password-confirmation"),
  welcome: path(ROOTS_AUTH, "/welcome"),
  verifyEmail: path(ROOTS_AUTH, "/verify-email"),
  accountDelete: path(ROOTS_AUTH, "/account-delete"),
};

export const PATH_ERROR = {
  root: ROOTS_ERRORS,
  error400: path(ROOTS_ERRORS, "/400"),
  error403: path(ROOTS_ERRORS, "/403"),
  error404: path(ROOTS_ERRORS, "/404"),
  error500: path(ROOTS_ERRORS, "/500"),
  error503: path(ROOTS_ERRORS, "/503"),
};

export const AUTHENTICATION_ITEMS = [
  { title: "sign in", path: PATH_AUTH.signin },
  { title: "password reset", path: PATH_AUTH.passwordReset },
];
export const ERROR_ITEMS = [
  { title: "400", path: PATH_ERROR.error400 },
  { title: "403", path: PATH_ERROR.error403 },
  { title: "404", path: PATH_ERROR.error404 },
  { title: "500", path: PATH_ERROR.error500 },
  { title: "503", path: PATH_ERROR.error503 },
];

export const ACCESS_TOKEN = "token";
export const USER_NAME = "username";
export const THEME_STORAGE_KEY = "themeKey";
export const USER_EMAIL = "userEmail";
export const DEFAULT_LANGUAGE = "selectedLang";

export const UI_DATE_FORMAT = "YYYY-MM-DD";

export const CONTACTS_URL = "LT";
export const FILTER_PARAMS = "";
export const SEARCH_THRESHOLD = 0.2;

export const taxTypes = [
  { id: "PERCENTAGE", name: "نسبة من المبلغ الكلي" },
  { id: "FIXED", name: "كمية من المبلغ الكلي" },
];

export const DefaultModalPageSizeOptions = [20, 50, 100];

export enum ModalSize {
  "small",
  "default",
  "large",
  "medium",
}

export const paymentTypes: { id: string; name: string }[] = [
  { id: "CASH", name: t("cash") },
  { id: "E-PAYMENT", name: t("e-payment") },
  { id: "DEBIT", name: t("debit") },
];
function path(root: string, sublink: string) {
  return `${root}${sublink}`;
}

export const ROOTS_LANDING = import.meta.env.VITE_BASE_URL;
export const API_BASE_URL = import.meta.env.VITE_BASE_API_URL;

export const PATHS = {
  root: ROOTS_DEFAULT,
  menu: path(ROOTS_DEFAULT, "/menu"),
  address: path(ROOTS_DEFAULT, "/address"),
  order: path(ROOTS_DEFAULT, "/order"),
  profile: path(ROOTS_DEFAULT, "/profile"),
  settings: path(ROOTS_DEFAULT, "/settings"),
  support: path(ROOTS_DEFAULT, "/support"),
  terms: path(ROOTS_DEFAULT, "/terms"),
  privacy: path(ROOTS_DEFAULT, "/privacy"),
};

export const RESTAURANT_DETAILS_URL = `${BASE_URL}restaurants/one`;
export const PRODUCTS_AND_CATEGORIES_URL = `${BASE_URL}getRestaurantItems/`;
export const PRODUCT_DETAILS_URL = `${BASE_URL}getOptionsForItem/`;
export const ORDERS_URL = `${BASE_URL}customer_orders`;
export const ORDER_DETAILS_URL = `${BASE_URL}restaurant/getOneOrderForWebmenu`;
export const CREATE_ORDER_URL = `${BASE_URL}create_order_webmenu`;
export const CANCEL_ORDER_URL = `${BASE_URL}restaurant/cancelOrder`;
export const TABLES_URL = `${BASE_URL}restaurant/getTables`;
export const LOGIN_URL = `${API_BASE_URL}login`;
export const SEND_OTP_URL = `${API_BASE_URL}sendOtp`;
export const CONFIRM_OTP_URL = `${API_BASE_URL}confirmOtp`;
export const PAYMENT_CONFIRMATION_URL = `https://menu.fascano.com/payment/confirmation`;
