import type { Db } from '@mosaicstack/db';
import { createProjectsRepo, type ProjectsRepo } from './projects.js';
import { createMissionsRepo, type MissionsRepo } from './missions.js';
import { createMissionTasksRepo, type MissionTasksRepo } from './mission-tasks.js';
import { createTasksRepo, type TasksRepo } from './tasks.js';
import { createConversationsRepo, type ConversationsRepo } from './conversations.js';
import { createAgentsRepo, type AgentsRepo } from './agents.js';

export interface Brain {
  projects: ProjectsRepo;
  missions: MissionsRepo;
  missionTasks: MissionTasksRepo;
  tasks: TasksRepo;
  conversations: ConversationsRepo;
  agents: AgentsRepo;
}

export function createBrain(db: Db): Brain {
  return {
    projects: createProjectsRepo(db),
    missions: createMissionsRepo(db),
    missionTasks: createMissionTasksRepo(db),
    tasks: createTasksRepo(db),
    conversations: createConversationsRepo(db),
    agents: createAgentsRepo(db),
  };
}
