import { Module } from '@nestjs/common'
import { MongooseModule } from '@nestjs/mongoose'
import {
  AgentSession, AgentSessionSchema,
  ClientFolder, ClientFolderSchema,
  Matter, MatterSchema,
  Email, EmailSchema,
  Hearing, HearingSchema,
  Invoice, InvoiceSchema,
  FormTemplate, FormTemplateSchema,
  FormGenerationLog, FormGenerationLogSchema,
  LegalDocument, LegalDocumentSchema,
  LawCorpusEntry, LawCorpusEntrySchema,
} from '../common/schemas'
import { AgentToolsService } from './agent-tools.service'
import { PromptAnalystService } from './prompt-analyst.service'
import { CaseSituationAnalystService } from './case-analyst.service'
import { AgentController } from './agent.controller'
import { RagAgentModule } from '../rag-agent/rag-agent.module'
import { DocumentClassifierModule } from '../document-classifier/document-classifier.module'
import { FormTemplatesService } from '../form-templates/form-templates.service'
import { FormCalibrationAgent } from '../form-templates/form-calibration.agent'

@Module({
  imports: [
    MongooseModule.forFeature([
      { name: AgentSession.name,      schema: AgentSessionSchema },
      { name: ClientFolder.name,      schema: ClientFolderSchema },
      { name: Matter.name,            schema: MatterSchema },
      { name: Email.name,             schema: EmailSchema },
      { name: Hearing.name,           schema: HearingSchema },
      { name: Invoice.name,           schema: InvoiceSchema },
      { name: FormTemplate.name,      schema: FormTemplateSchema },
      { name: FormGenerationLog.name, schema: FormGenerationLogSchema },
      { name: LegalDocument.name,     schema: LegalDocumentSchema },
      { name: LawCorpusEntry.name,    schema: LawCorpusEntrySchema },
    ]),
    RagAgentModule,
    DocumentClassifierModule,
  ],
  providers: [
    AgentToolsService,
    CaseSituationAnalystService,
    PromptAnalystService,
    FormTemplatesService,
    FormCalibrationAgent,
  ],
  controllers: [AgentController],
})
export class AgentModule {}
