export interface RawCpvItem {
  CODE: string;
  TEXT: string;
}

export interface RawCpvDataset {
  CPV_CODE: {
    CPV: RawCpvItem[];
  };
}

export type SynonymMap = Record<string, string[]>;

export interface CpvEntry {
  code: string;
  text: string;
  normalizedCode: string;
  normalizedText: string;
  normalizedSearch: string;
}

export interface SearchMatch {
  code: string;
  text: string;
  score: number;
  matchType: "code" | "name" | "synonym";
  synonymTerm?: string;
}

export interface SearchResultPayload {
  query: string;
  returned: number;
  matches: Array<{
    code: string;
    text: string;
    matchType: string;
    synonymTerm?: string;
  }>;
}

export interface PluginConfig {
  defaultLimit: number;
  maxLimit: number;
}

export interface SearchParams {
  query: string;
  limit?: number;
}
