/**
 * Action
 * ------
 * Represents an individual action (permission) under a menu.
 *
 * Example actions:
 * - create
 * - update
 * - delete
 * - view
 */
export type Action = {
  /** Unique action identifier */
  id: number;

  /** Parent menu ID this action belongs to */
  menu_id: number;

  /** Action key (used for permission checks, e.g., 'create', 'edit') */
  action: string;

  /** Human-readable label for UI display */
  title: string;

  /** Order in which the action appears in the UI */
  order_no: number;

  /** Visibility flag (1 = visible, 0 = hidden) */
  is_visible: number;

  /** Active status flag (1 = active, 0 = inactive) */
  active: number;

  /** User ID who created this record (nullable for system records) */
  by_user: number | null;

  /** Creation timestamp */
  created: string;

  /** User ID who last modified this record */
  modified_by_user: number | null;

  /** Last modification timestamp */
  modified: string;
};

/**
 * Menu
 * ----
 * Represents a navigational menu item in the application.
 *
 * A menu can contain multiple actions (permissions).
 */
export type Menu = {
  /** Unique menu identifier */
  id: number;

  /** Menu group ID this menu belongs to */
  menu_group_id: number;

  /** Controller name mapped to this menu (used in routing/permissions) */
  controller: string;

  /** Menu title displayed in UI */
  title: string;

  /** Optional icon class or icon identifier */
  icon: string | null;

  /** Display order within the menu group */
  order_no: number;

  /** Visibility flag (1 = visible, 0 = hidden) */
  is_visible: number;

  /** Active status flag (1 = active, 0 = inactive) */
  active: number;

  /** User ID who created this menu */
  by_user: number | null;

  /** Creation timestamp */
  created: string;

  /** User ID who last modified this menu */
  modified_by_user: number | null;

  /** Last modification timestamp */
  modified: string;

  /** List of actions (permissions) under this menu */
  actions: Action[];
};

/**
 * MenuGroup
 * ---------
 * Represents a top-level grouping of menus.
 *
 * Example groups:
 * - Masters
 * - Leads
 * - Sales
 * - Settings
 */
export type MenuGroup = {
  /** Unique menu group identifier */
  id: number;

  /** Display name of the menu group */
  name: string;

  /** Order in which the group appears in navigation */
  order_no: number;

  /** Active status flag (1 = active, 0 = inactive) */
  active: number;

  /** User ID who created this group */
  by_user: number;

  /** Creation timestamp */
  created: string;

  /** User ID who last modified this group */
  modified_by_user: number;

  /** Last modification timestamp */
  modified: string;

  /** Menus that belong to this group */
  menus: Menu[];
};
