export const ROOT_PATH = '/';

export type LoginPathSearchParams = {
  username?: string;
  email?: string;
};
export const LOGIN_PATH = '/login/:server?/';

export type RegisterPathSearchParams = {
  username?: string;
  email?: string;
  token?: string;
};
export const REGISTER_PATH = '/register/:server?/';

export type ResetPasswordPathSearchParams = {
  email?: string;
};
export const RESET_PASSWORD_PATH = '/reset-password/:server?/';

export const _CREATE_PATH = 'create/';
export const _JOIN_PATH = 'join/';
export const _LOBBY_PATH = 'lobby/';
/**
 * array of rooms and senders mxId assigned
 * to search param as string should be "," separated
 * Like: url?rooms=!one:server,!two:server
 */
export type _SearchPathSearchParams = {
  global?: string;
  term?: string;
  order?: string;
  rooms?: string;
  senders?: string;
};
export const _SEARCH_PATH = 'search/';

export type _RoomSearchParams = {
  /* comma separated string of servers */
  viaServers?: string;
};
export const _ROOM_PATH = ':roomIdOrAlias/:eventId?/';

export const HOME_PATH = '/home/';
export const HOME_CREATE_PATH = `/home/${_CREATE_PATH}`;
export const HOME_JOIN_PATH = `/home/${_JOIN_PATH}`;
export const HOME_SEARCH_PATH = `/home/${_SEARCH_PATH}`;
export const HOME_ROOM_PATH = `/home/${_ROOM_PATH}`;

export const DIRECT_PATH = '/direct/';
export type DirectCreateSearchParams = {
  userId?: string;
};
export const DIRECT_CREATE_PATH = `/direct/${_CREATE_PATH}`;
export const DIRECT_ROOM_PATH = `/direct/${_ROOM_PATH}`;

export const SPACE_PATH = '/:spaceIdOrAlias/';
export const SPACE_LOBBY_PATH = `/:spaceIdOrAlias/${_LOBBY_PATH}`;
export const SPACE_SEARCH_PATH = `/:spaceIdOrAlias/${_SEARCH_PATH}`;
export const SPACE_ROOM_PATH = `/:spaceIdOrAlias/${_ROOM_PATH}`;

export const _FEATURED_PATH = 'featured/';
export const _SERVER_PATH = ':server/';
export const EXPLORE_PATH = '/explore/';
export const EXPLORE_FEATURED_PATH = `/explore/${_FEATURED_PATH}`;

export type ExploreServerPathSearchParams = {
  limit?: string;
  since?: string;
  term?: string;
  type?: string;
  instance?: string;
};
export const EXPLORE_SERVER_PATH = `/explore/${_SERVER_PATH}`;

export const CREATE_PATH = '/create';

// Deep-link path for https://vojo.chat/u/<user>. `<user>` is either a localpart
// (test3) or a full MXID (@test3:vojo.chat); the redirect route normalizes it
// and forwards to /direct/create?userId=<mxid>. The implicit homeserver for a
// bare localpart is the link's own host (vojo.chat) — NOT the logged-in user's
// homeserver: a user signed into matrix.org opening vojo.chat/u/test3 means
// @test3:vojo.chat, otherwise we'd send messages to the wrong MXID entirely.
// Keep this in sync with the App Links intent-filter in AndroidManifest.xml.
export const USER_LINK_HOST = 'vojo.chat';
export const USER_LINK_PATH = '/u/:userIdOrLocalPart';

export const BOTS_PATH = '/bots/';
export const BOTS_BOT_PATH = '/bots/:botId/';
// A single conversation (m.thread root) inside an assistant bot's control DM. Mirrors
// CHANNELS_THREAD_PATH so the reused ThreadDrawer opens off a URL the same way it does in
// channels, but scoped under the bot route (no channelsMode, no space/room segments).
export const BOTS_BOT_THREAD_PATH = '/bots/:botId/thread/:rootId/';

export const CHANNELS_PATH = '/channels/';
export const CHANNELS_SPACE_PATH = '/channels/:spaceIdOrAlias/';
export const CHANNELS_ROOM_PATH = '/channels/:spaceIdOrAlias/:roomIdOrAlias/';
// Event-anchored channel room URL — discriminated `event/` segment so the
// optional eventId does not collide with the sibling `thread/:rootId/`
// sub-route. Search/inbox/mention/push permalinks land here so the timeline
// can scroll to the cited event without dropping the user out of /channels/.
export const CHANNELS_ROOM_EVENT_PATH = '/channels/:spaceIdOrAlias/:roomIdOrAlias/event/:eventId/';
export const CHANNELS_THREAD_PATH = '/channels/:spaceIdOrAlias/:roomIdOrAlias/thread/:rootId/';

export const SPACE_SETTINGS_PATH = '/space-settings/';

export const ROOM_SETTINGS_PATH = '/room-settings/';

// User-settings as a first-class route. Mounted inside the authed
// tree wrapped in the same PageRoot+Direct shell as `/direct/`, so the
// DM list stays on the left and Settings renders in the right pane as
// a nested horseshoe (menu | 12px void | content). On mobile the route
// is a deep-link entry only — `SettingsScreen` redirects to /direct/
// and sets the `settingsSheetAtom`, which `MobileSettingsHorseshoe`
// inside Direct renders as a bottom-up overlay. Replaces the pre-
// redesign Modal500 dialog opened from SettingsTab / DirectSelfRow /
// UnverifiedTab. The `page` query param deep-links into a specific
// sub-screen — keys defined by `SETTINGS_PAGE_PARAM` in
// `features/settings/Settings.tsx`.
export const SETTINGS_PATH = '/settings/';
export type SettingsPathSearchParams = {
  page?: string;
};
