export interface Language {
  langCode: string;
  langName: string;
  langNative: string;
  isActive: string;
  sortOrder?: number;
  createdDate?: Date;
  createdBy?: string;
  updatedDate?: Date;
  updatedBy?: string;
}

export interface LangKey {
  keyId?: number;
  companyCode: string;
  menuName?: string;
  langKey: string;
  description?: string;
  isActive: string;
  categoryId?: number;
  keyMeaning?: string;
  usageNote?: string;
  baseKeyId?: number;
  createdDate?: Date;
  createdBy?: string;
  updatedDate?: Date;
  updatedBy?: string;
}

// 카테고리 인터페이스
export interface LangCategory {
  categoryId: number;
  categoryCode: string;
  categoryName: string;
  parentId?: number | null;
  level: number;
  keyPrefix: string;
  description?: string;
  sortOrder: number;
  isActive: string;
  children?: LangCategory[];
}

export interface LangText {
  textId?: number;
  keyId: number;
  langCode: string;
  langText: string;
  isActive: string;
  createdDate?: Date;
  createdBy?: string;
  updatedDate?: Date;
  updatedBy?: string;
}

export interface LangKeyWithTexts extends LangKey {
  texts: LangText[];
}

export interface CreateLanguageRequest {
  langCode: string;
  langName: string;
  langNative: string;
  isActive?: string;
  sortOrder?: number;
  createdBy?: string;
  updatedBy?: string;
}

export interface UpdateLanguageRequest {
  langName?: string;
  langNative?: string;
  isActive?: string;
  sortOrder?: number;
  updatedBy?: string;
}

export interface CreateLangKeyRequest {
  companyCode: string;
  menuName?: string;
  langKey: string;
  description?: string;
  isActive?: string;
  categoryId?: number;
  keyMeaning?: string;
  usageNote?: string;
  baseKeyId?: number;
  createdBy?: string;
  updatedBy?: string;
}

// 자동 키 생성 요청
export interface GenerateKeyRequest {
  companyCode: string;
  categoryId: number;
  keyMeaning: string;
  usageNote?: string;
  texts: Array<{
    langCode: string;
    langText: string;
  }>;
  createdBy?: string;
}

// 오버라이드 키 생성 요청
export interface CreateOverrideKeyRequest {
  companyCode: string;
  baseKeyId: number;
  texts: Array<{
    langCode: string;
    langText: string;
  }>;
  createdBy?: string;
}

export interface UpdateLangKeyRequest {
  companyCode?: string;
  menuName?: string;
  langKey?: string;
  description?: string;
  updatedBy?: string;
}

export interface SaveLangTextsRequest {
  texts: Array<{
    langCode: string;
    langText: string;
    isActive?: string;
    createdBy?: string;
    updatedBy?: string;
  }>;
}

export interface GetLangKeysParams {
  companyCode?: string;
  menuCode?: string;
  keyType?: string;
  searchText?: string;
  categoryId?: number;
  includeOverrides?: boolean;
  page?: number;
  limit?: number;
}

export interface GetUserTextParams {
  companyCode: string;
  menuCode: string;
  langKey: string;
  userLang: string;
}

export interface BatchTranslationRequest {
  companyCode: string;
  menuCode?: string;
  userLang: string;
  langKeys: string[];
}

export interface TranslationCacheEntry {
  data: Record<string, string>;
  timestamp: number;
}

export interface ApiResponse<T = any> {
  success: boolean;
  message?: string;
  data?: T;
  error?: {
    code: string;
    details?: any;
  };
  pagination?: {
    page: number;
    limit: number;
    total: number;
    totalPages: number;
  };
}
