import { Module } from '@nestjs/common'
import { MongooseModule } from '@nestjs/mongoose'
import { AuthModule } from '../auth/auth.module.js'
import { IntegrationsModule } from '../integrations/integrations.module.js'
import { Price, PriceSchema } from '../schemas/price.schema.js'
import { Subscription, SubscriptionSchema } from '../schemas/subscription.schema.js'
import { PricesController } from './prices.controller.js'
import { PricesService } from './prices.service.js'

@Module({
  imports: [
    // Subscription model + Stripe client live here so a catalog amount edit can
    // propagate to live subscriptions (mint new Stripe Price, repoint subs).
    MongooseModule.forFeature([
      { name: Price.name, schema: PriceSchema },
      { name: Subscription.name, schema: SubscriptionSchema },
    ]),
    AuthModule,
    IntegrationsModule,
  ],
  controllers: [PricesController],
  providers: [PricesService],
  exports: [PricesService],
})
export class PricesModule {}
