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 { IntegrationsModule } from '../integrations/integrations.module.js'
import { Invoice, InvoiceSchema } from '../schemas/invoice.schema.js'
import { Partner, PartnerSchema } from '../schemas/partner.schema.js'
import { Payout, PayoutSchema } from '../schemas/payout.schema.js'
import { Subscription, SubscriptionSchema } from '../schemas/subscription.schema.js'
import { Tenant, TenantSchema } from '../schemas/tenant.schema.js'
import { UsersModule } from '../users/users.module.js'
import { BillingService } from './billing.service.js'
import { CustomerBillingController } from './customer-billing.controller.js'
import { OperatorBillingController } from './operator-billing.controller.js'
import { PartnerBillingController } from './partner-billing.controller.js'
import { PayoutWorker } from './payout.worker.js'
import { StripeWebhookController } from './stripe-webhook.controller.js'

@Module({
  imports: [
    MongooseModule.forFeature([
      { name: Invoice.name, schema: InvoiceSchema },
      { name: Payout.name, schema: PayoutSchema },
      { name: Subscription.name, schema: SubscriptionSchema },
      { name: Partner.name, schema: PartnerSchema },
      { name: Tenant.name, schema: TenantSchema },
    ]),
    AuthModule,
    AuditModule,
    IntegrationsModule,
    UsersModule,
  ],
  controllers: [
    PartnerBillingController,
    OperatorBillingController,
    CustomerBillingController,
    StripeWebhookController,
  ],
  providers: [BillingService, PayoutWorker],
})
export class BillingModule {}
