import { forwardRef, Module } from "@nestjs/common";
import { TypeOrmModule } from "@nestjs/typeorm";

import { BillingController } from "./billing.controller";
import { PortalBillingController } from "./portal-billing.controller";
import { PaymentController } from "./payment.controller";
import { BillingService } from "./billing.service";
import { DocumentsModule } from "./documents/documents.module";
import { Invoice } from "./entities/invoice.entity";
import { InvoiceLine } from "./entities/invoice-line.entity";
import { InvoiceRepository } from "./invoice.repository";
import { InvoiceLineRepository } from "./invoice-line.repository";
import { PaymentModule } from "../payment/payment.module";
import { CompaniesModule } from "../companies/companies.module";

@Module({
  imports: [
    TypeOrmModule.forFeature([Invoice, InvoiceLine]),
    forwardRef(() => PaymentModule),
    CompaniesModule,
    DocumentsModule,
  ],
  controllers: [BillingController, PortalBillingController, PaymentController],
  providers: [BillingService, InvoiceRepository, InvoiceLineRepository],
  exports: [BillingService],
})
export class BillingModule {}
