export type RouteWithParam = (param: string) => string;
export type Route = string | RouteWithParam;

export type AppRoutes = {
  about: string;

  // Home and admin
  home: string;
  admin: {
    base: string;
  };

  // Article routes
  allArticles: string;
  article: RouteWithParam;
  editArticle: RouteWithParam;

  // Category routes
  allCategories: string;
  category: RouteWithParam;
  editCategory: RouteWithParam;

  // Auth routes
  signin: string;
  signup: string;
  signout: string;
  profile: string;
};

export const appRoutes: AppRoutes = {
  about: "/logipedia",
  home: "/",
  admin: { base: "/admin" },

  // article
  allArticles: "/artikel",
  article: (slug) => `/artikel/${slug}`,
  editArticle: (slug) => `/artikel/${slug}/bearbeiten`,

  // category
  allCategories: "/kategorie",
  category: (slug) => `/kategorie/${slug}`,
  editCategory: (slug) => `/kategorie/${slug}/bearbeiten`,

  // auth
  signin: "/api/auth/signin",
  signup: "/api/auth/signin",
  signout: "/api/auth/signout",
  profile: "/me",
};
