const getUrl = (url: string) => {
  return `api/app/${url}`
}

const api = {
  login: getUrl('authenticate'),
  logout: getUrl('logout'),
  Me: {
    language: getUrl('me/language'),
    info: getUrl('me/info'),
    index: getUrl('me'),
    avatar: getUrl('me/avatar'),
    notify: getUrl('me/notify'),
    notifyTest: getUrl('me/notify-test'),
    password: getUrl('me/password'),
    update: (id: bigint) => getUrl(`me/${id}/update`),
  },
  Index: getUrl('index'),
  Dashboard: getUrl('dashboard'),
  Notification: {
    index: getUrl('notifications'),
    makeRead: getUrl('notification/make-read'),
  },
  Scanner: {
    logisticOrder: getUrl('scan/logistic-order'),
    myLogisticOrder: getUrl('scan/my-logistic-order'),
  },
  StorageBin: {
    index: getUrl('shop/storage-bins'),
    show: (id: bigint) => getUrl(`shop/storage-bin/${id}`),
    query: getUrl('shop/storage-bins-query'),
    print: getUrl('shop/storage-bins-print'),
    store: getUrl('shop/storage-bin'),
    splitPortion: (id: bigint, n: number) => getUrl(`shop/storage-bin/${id}/split/${n}`),
  },
  Shelve: {
    index: getUrl('shop/shelves'),
    print: getUrl('shop/shelves-print'),
    store: getUrl('shop/shelve'),
    show: (id: bigint) => getUrl(`shop/shelve/${id}`),
  },
  ProductSpec: {
    index: getUrl('shop/product-specs'),
    update: (id: bigint) => getUrl(`shop/product-spec/${id}/update`),
    edit: (id: bigint) => getUrl(`shop/product-spec/${id}/edit`),
    print: getUrl('shop/product-spec-print'),
  },
  Printer: {
    index: getUrl('printer'),
    setToMe: getUrl('printer/set-to-me'),
    print: getUrl('printer/print-receipt'),
  },
}

export default api
