import { MenuTypeEnum } from '@/enums/MenuTypeEnum';

/**
 * 菜单树形结构类型
 */
export interface MenuTreeOption {
  id: string | number;
  label: string;
  parentId: string | number;
  weight: number;
  children?: MenuTreeOption[];
  menuCategory?: string;
  menuType?: string;
}

export interface RoleMenuTree {
  menus: MenuTreeOption[];
  checkedKeys: string[];
}

/**
 * 菜单查询参数类型
 */
export interface MenuQuery {
  keywords?: string;
  menuName?: string;
  status?: string;
  branchType?: string; // 渠道查询参数
  parentId?: string | number; // 父菜单ID
  helpCode?: string; // 帮助代码查询参数
  menuCategory?: string; // 🆕 菜单归属查询参数
}

/**
 * 菜单视图对象类型
 */
export interface MenuVO extends BaseEntity {
  parentName: string;
  parentId: string | number;
  children: MenuVO[];
  menuId: string | number;
  menuName: string;
  orderNum: number;
  path: string;
  component: string;
  queryParam: string;
  isFrame: string;
  isCache: string;
  menuType: MenuTypeEnum;
  visible: string;
  status: string;
  icon: string;
  remark: string;
  branchType?: string; // 渠道字段
  helpCode?: string; // 帮助代码字段
  menuCategory?: string; // 🆕 菜单归属字段
  // 统计属性
  menuCount?: number;
  buttonCount?: number;
}

/**
 * 菜单排序视图对象类型
 */
export interface MenuSortVO {
  menuId: number;
  menuName: string;
  parentId: number;
  orderNum: number;
  menuType: string;
  icon?: string;
  status: string;
  visible: string;
  perms?: string;
  path?: string;
  component?: string;
  menuCategory?: string;
  branchType?: string;
  helpCode?: string;
  menuPath?: string;
  children?: MenuSortVO[];
  disabled?: boolean;
  isLeaf?: boolean;
}

/**
 * 菜单排序请求类型
 */
export interface MenuSortRequest {
  menuId: number;
  parentId: number;
  orderNum: number;
  menuName?: string;
  menuType?: string;
  children?: MenuSortRequest[];
}

export interface MenuForm {
  parentName?: string;
  parentId?: string | number;
  children?: MenuForm[];
  menuId?: string | number;
  menuName: string;
  orderNum: number;
  path: string;
  component?: string;
  queryParam?: string;
  isFrame?: string;
  isCache?: string;
  menuType?: MenuTypeEnum;
  visible?: string;
  status?: string;
  icon?: string;
  branchType?: string; // 渠道字段
  branchTypeList?: string[]; // 前端使用的数组
  helpCode?: string; // 帮助代码字段
  menuCategory?: string; // 🆕 菜单归属字段
  remark?: string;
  query?: string;
  perms?: string;
}
