import { Module } from '@nestjs/common';
import { CqrsModule } from '@nestjs/cqrs';
import { CreateProjectHandler } from './application/commands/create-project/create-project.handler';
import { DeleteProjectHandler } from './application/commands/delete-project/delete-project.handler';
import { UpdateProjectHandler } from './application/commands/update-project/update-project.handler';
import { GetProjectHandler } from './application/queries/get-project/get-project.handler';
import { GetProjectStatsHandler } from './application/queries/get-project-stats/get-project-stats.handler';
import { ListProjectsHandler } from './application/queries/list-projects/list-projects.handler';
import { PROJECT_REPOSITORY } from './domain/repositories/project-development.repository';
import { PrismaProjectDevelopmentRepository } from './infrastructure/repositories/prisma-project-development.repository';
import { ProjectsController } from './presentation/controllers/projects.controller';

const CommandHandlers = [CreateProjectHandler, UpdateProjectHandler, DeleteProjectHandler];
const QueryHandlers = [GetProjectHandler, ListProjectsHandler, GetProjectStatsHandler];

@Module({
  imports: [CqrsModule],
  controllers: [ProjectsController],
  providers: [
    { provide: PROJECT_REPOSITORY, useClass: PrismaProjectDevelopmentRepository },
    ...CommandHandlers,
    ...QueryHandlers,
  ],
  exports: [PROJECT_REPOSITORY],
})
export class ProjectsModule {}
