/**
 * 메뉴 관련 타입 정의
 */

export interface MenuItem {
  objid: string;
  parentObjId: string;
  menuNameKor: string;
  menuNameEng: string;
  menuUrl: string;
  menuDesc: string;
  status: "ACTIVE" | "INACTIVE";
  statusTitle: string;
  seq: number;
  lev: number;
  menuType: "admin" | "user";
  lpadMenuNameKor: string;
  writer?: string;
  regdate?: string;
  company_code?: string;
  company_name?: string;

  // 계층적 메뉴 구조를 위한 필드들
  children?: MenuItem[];

  // 아이콘 필드
  menu_icon?: string;

  // 번역 관련 필드들
  translated_name?: string;
  translated_desc?: string;
  lang_key?: string;
  lang_key_desc?: string;

  // 백엔드에서 오는 대문자 키들 (fallback)
  OBJID?: string;
  PARENT_OBJ_ID?: string;
  MENU_NAME_KOR?: string;
  MENU_NAME_ENG?: string;
  MENU_URL?: string;
  MENU_DESC?: string;
  STATUS?: string;
  STATUS_TITLE?: string;
  SEQ?: number;
  LEV?: number;
  MENU_TYPE?: string;
  LPAD_MENU_NAME_KOR?: string;
  WRITER?: string;
  REGDATE?: string;
  COMPANY_CODE?: string;
  COMPANY_NAME?: string;

  // 아이콘 대문자 키
  MENU_ICON?: string;

  // 번역 관련 대문자 키들
  TRANSLATED_NAME?: string;
  TRANSLATED_DESC?: string;
  LANG_KEY?: string;
  LANG_KEY_DESC?: string;
}

export interface MenuState {
  menuList: MenuItem[];
  expandedMenus: Set<string>;
  isLoading: boolean;
}

export interface MenuFormData {
  menuNameKor: string;
  menuNameEng: string;
  menuUrl: string;
  menuDesc: string;
  status: "ACTIVE" | "INACTIVE";
  seq: number;
  parentObjId: string;
  menuType: "admin" | "user";
}

export interface MenuApiResponse {
  success: boolean;
  data?: MenuItem[];
  message?: string;
  errorCode?: string;
}

export interface MenuFormResponse {
  success: boolean;
  message: string;
  errorCode?: string;
}
