export type ObjectListParams = {
  limit: number;
  offset: number;
  sort?: string;
  order?: "asc" | "desc";
  visibility?: string;
  q?: string;
};

/** Central query-key factory — the single source of truth for cache keys, so
 *  query/invalidate/setQueryData sites can't drift. */
export const keys = {
  me: () => ["me"] as const,
  config: () => ["config"] as const,
  objects: () => ["objects"] as const,
  objectsPage: (params: ObjectListParams) => ["objects", params] as const,
  object: (id: string) => ["object", id] as const,
  fieldDefinitions: () => ["field-definitions"] as const,
  vocabularies: () => ["vocabularies"] as const,
  terms: (vocabularyId: string | null | undefined) => ["terms", vocabularyId] as const,
  authorities: (kind: string | null | undefined) => ["authorities", kind] as const,
  search: () => ["search"] as const,
  searchResults: (term: string, visibility: string | null) => ["search", term, visibility] as const,
};
