import { MODULE_PATHS } from "../../lib/paths";
import type { CategoryConfig, TestCaseCategoryConfig } from "../../lib/sync-check/shared";
import type { ModelCategoryConfig } from "./models";

export function moduleCategories(root: string): CategoryConfig[] {
  return [
    {
      name: "command",
      sourcePattern: `${root}/*/${MODULE_PATHS.commands}/*.ts`,
      docPattern: `${root}/*/${MODULE_PATHS.docs.command}/*.md`,
      exclusions: [/\.test\.ts$/, /\.generated\.ts$/],
    },
    {
      name: "query",
      sourcePattern: `${root}/*/${MODULE_PATHS.queries}/*.ts`,
      docPattern: `${root}/*/${MODULE_PATHS.docs.query}/*.md`,
      exclusions: [/\.test\.ts$/],
    },
  ];
}

export function moduleModelCategory(root: string): ModelCategoryConfig {
  return {
    name: "model",
    sourcePattern: `${root}/*/${MODULE_PATHS.db}/*.ts`,
    docPattern: `${root}/*/${MODULE_PATHS.docs.model}/*.md`,
    exclusions: [/\.test\.ts$/, /^index\.ts$/, /\.generated\.ts$/],
  };
}

export function moduleTestCaseCategories(root: string): TestCaseCategoryConfig[] {
  return [
    {
      name: "command-test-case",
      docPattern: `${root}/*/${MODULE_PATHS.docs.command}/*.md`,
      testDir: MODULE_PATHS.commands,
    },
    {
      name: "query-test-case",
      docPattern: `${root}/*/${MODULE_PATHS.docs.query}/*.md`,
      testDir: MODULE_PATHS.queries,
    },
  ];
}
