/**
 * Route interface
 * The interface for one a route in the app
 */
export interface Route {
  /**
   * Path of the route
   */
  path: string;
  /**
   * Title of the route
   */
  title: string;
  /**
   * Whether the route is a popup or not
   * if true, the route will be rendered as a popup
   * TODO: handle popup
   */
  popup?: boolean;
  /**
   * if set to true, it will set a partial route
   * with the last url param as the id of a partial view
   * Usually used when wanting to open a tab, section or view
   * @optional
   */
  openPartial?: boolean;
  /**
   * Component to render
   * Note: This component does not need to be an observer
   * (wrapped as ApphouseComponent)
   * because we will do that when rendering it
   * @returns JSX.Element
   */
  component: (...args: any[]) => JSX.Element;
  /**
   * Any action to perform when opening the route
   * @optional
   * @param params the url params
   * @returns void
   */
  onOpen?: (...args: any[]) => void;
  /**
   * Any action to perform before opening the route
   * @optional
   * @param param the url params
   * @returns void
   */
  beforeOpen?: (...args: any[]) => void;
}

/**
 * Routing interface to be applied to the router
 */
export type Routing = { [key: string]: (...args: any[]) => void };
