import { Module } from '@nestjs/common';
import { ContestsModule as ContestsCoreModule } from './contests/contests.module';
import { AttachmentsModule } from './attachments/attachments.module';
import { ReviewRulesModule } from './review-rules/review-rules.module';
import { RegistrationsModule } from './registrations/registrations.module';
import { TeamsModule } from './teams/teams.module';
import { WorksModule } from './works/works.module';
import { ReviewsModule } from './reviews/reviews.module';
import { NoticesModule } from './notices/notices.module';
import { JudgesModule } from './judges/judges.module';
import { ResultsModule } from './results/results.module';
import { PresetCommentsModule } from './preset-comments/preset-comments.module';

@Module({
  imports: [
    // 子模块必须在 ContestsCoreModule 之前导入
    // 否则 /contests/:id 会先匹配，导致 /contests/notices 等路由失效
    AttachmentsModule,
    ReviewRulesModule,
    RegistrationsModule,
    TeamsModule,
    WorksModule,
    ReviewsModule,
    NoticesModule,
    JudgesModule,
    ResultsModule,
    PresetCommentsModule,
    // ContestsCoreModule 放在最后，因为它有通配符路由 /contests/:id
    ContestsCoreModule,
  ],
  exports: [
    ContestsCoreModule,
    AttachmentsModule,
    ReviewRulesModule,
    RegistrationsModule,
    TeamsModule,
    WorksModule,
    ReviewsModule,
    NoticesModule,
    JudgesModule,
    ResultsModule,
    PresetCommentsModule,
  ],
})
export class ContestsModule {}

