import { Module } from '@nestjs/common'
import { MongooseModule } from '@nestjs/mongoose'
import { AuditModule } from '../audit/audit.module.js'
import { AuthModule } from '../auth/auth.module.js'
import { PartnersModule } from '../partners/partners.module.js'
import {
  PartnerBranding,
  PartnerBrandingSchema,
} from '../schemas/partner-branding.schema.js'
import { Partner, PartnerSchema } from '../schemas/partner.schema.js'
import { Report, ReportSchema } from '../schemas/report.schema.js'
import { TenantsModule } from '../tenants/tenants.module.js'
import { UsersModule } from '../users/users.module.js'
import { PartnerBrandingService } from './partner-branding.service.js'
import { PartnerMeController } from './partner-me.controller.js'
import { PartnerReportsService } from './partner-reports.service.js'

// Self-service portal surface. Composes UsersService (partner-scoped reads,
// invitePartnerUser, inviteTenantAdmin, partnerMrr, partnerActivity) and
// TenantsService (create) behind clean /me/partner/* URLs. No service of
// its own — the controllers are thin façades.
@Module({
  imports: [
    AuthModule,
    AuditModule,
    UsersModule,
    TenantsModule,
    PartnersModule,
    MongooseModule.forFeature([
      { name: Partner.name, schema: PartnerSchema },
      { name: PartnerBranding.name, schema: PartnerBrandingSchema },
      { name: Report.name, schema: ReportSchema },
    ]),
  ],
  controllers: [PartnerMeController],
  providers: [PartnerBrandingService, PartnerReportsService],
})
export class MeModule {}
