export const TUNING_CONFIG = {
  SESSION_RECOVERY_HOURS: {
    default: 0.5,
    min: 0.5,
    max: 24,
    step: 0.5,
    description: "Time window in hours to offer session recovery.",
  },
  TEXT_CHUNK_MAX_WORDS: {
    default: 200,
    min: 50,
    max: 1000,
    step: 10,
    description: "Max words per text chunk for retrieval.",
  },
  FUZZY_MATCH_SCORE: {
    default: 0.75,
    min: 0.5,
    max: 0.95,
    step: 0.01,
    description: "Score for a fuzzy text match during retrieval.",
  },
  INTENT_CONFIDENCE_THRESHOLD: {
    default: 0.85,
    min: 0.5,
    max: 0.99,
    step: 0.01,
    description: "Minimum confidence for an intent to be valid.",
  },
  FUZZY_MATCH_CUTOFF_TEXT: {
    default: 0.5,
    min: 0.1,
    max: 0.9,
    step: 0.01,
    description: "Similarity cutoff for fuzzy text matching.",
  },
  FUZZY_MATCH_CUTOFF_RESORT_CANONICAL: {
    default: 0.8,
    min: 0.6,
    max: 1,
    step: 0.01,
    description: "Similarity cutoff for resolving a canonical resort name.",
  },
  FUZZY_MATCH_CUTOFF_RESORT_DETECT: {
    default: 0.83,
    min: 0.6,
    max: 0.95,
    step: 0.01,
    description: "Similarity cutoff for detecting a resort name in user text.",
  },
  FUZZY_MATCH_CUTOFF_MAPS: {
    default: 0.86,
    min: 0.6,
    max: 0.95,
    step: 0.01,
    description: "Similarity cutoff for fuzzy matching resort names for maps.",
  },
  FUZZY_MATCH_CUTOFF_ACCOMMODATION: {
    default: 0.72,
    min: 0.6,
    max: 0.9,
    step: 0.01,
    description:
      "Similarity cutoff for fuzzy matching resort names for accommodation.",
  },
  FUZZY_MATCH_CUTOFF_GALLERY: {
    default: 0.75,
    min: 0.6,
    max: 0.9,
    step: 0.01,
    description:
      "Similarity cutoff for fuzzy matching resort names for gallery.",
  },
  FUZZY_MATCH_CUTOFF_ITINERARY: {
    default: 0.75,
    min: 0.6,
    max: 0.9,
    step: 0.01,
    description:
      "Similarity cutoff for fuzzy matching resort names for itinerary.",
  },
  FUZZY_MATCH_CUTOFF_FACT_SHEET: {
    default: 0.75,
    min: 0.6,
    max: 0.9,
    step: 0.01,
    description:
      "Similarity cutoff for fuzzy matching resort names for fact sheet.",
  },
  FUZZY_MATCH_CUTOFF_DESTINATIONGUIDE: {
    default: 0.75,
    min: 0.6,
    max: 0.9,
    step: 0.01,
    description:
      "Similarity cutoff for fuzzy matching resort names for destination guide.",
  },
  RETRIEVAL_TOP_N: {
    default: 10,
    min: 1,
    max: 100,
    step: 1,
    description: "Number of top results to retrieve from vector search.",
  },
  TEMPERATURE: {
    default: 0.7,
    min: 0,
    max: 2,
    step: 0.1,
    description:
      "LLM generation temperature. Higher = more creative. Applies to all answer generation calls.",
  },
  RESOLVER_TEMPERATURE: {
    default: 0.2,
    min: 0,
    max: 1,
    step: 0.05,
    description:
      "Temperature for the resolver (query routing) call. Keep low for consistent JSON output.",
  },
  RECENT_HISTORY_LIMIT: {
    default: 20,
    min: 5,
    max: 100,
    step: 1,
    description:
      "Number of recent conversation turns sent to the LLM per turn.",
  },
} as const;

export type RequiredTuningKey = keyof typeof TUNING_CONFIG;

export const REQUIRED_TUNING_KEYS = Object.keys(
  TUNING_CONFIG,
) as RequiredTuningKey[];

export const DEFAULT_TUNING = Object.fromEntries(
  Object.entries(TUNING_CONFIG).map(([key, config]) => [key, config.default]),
) as Record<RequiredTuningKey, number>;
