import { Module, forwardRef } from '@nestjs/common';
import { ScheduleModule } from '@nestjs/schedule';
import { InfrastructureModule } from '../infrastructure/infrastructure.module';
import { ApiModule } from '../api/api.module';
import { OrderService } from './services/order.service';
// [2026-03-04] 新增：预种卖出限制检查（HTTP + Redis 缓存，fail-open）
import { TradingSellRestrictionService } from './services/sell-restriction.service';
import { TransferService } from './services/transfer.service';
import { P2pTransferService } from './services/p2p-transfer.service';
import { PriceService } from './services/price.service';
import { BurnService } from './services/burn.service';
import { AssetService } from './services/asset.service';
import { MarketMakerService } from './services/market-maker.service';
import { C2cService } from './services/c2c.service';
import { C2cBotService } from './services/c2c-bot.service';
import { PaymentProofService } from './services/payment-proof.service';
import { AuditLedgerService } from './services/audit-ledger.service';
import { OutboxScheduler } from './schedulers/outbox.scheduler';
import { BurnScheduler } from './schedulers/burn.scheduler';
import { PriceBroadcastScheduler } from './schedulers/price-broadcast.scheduler';
import { C2cExpiryScheduler } from './schedulers/c2c-expiry.scheduler';
import { C2cBotScheduler } from './schedulers/c2c-bot.scheduler';

@Module({
  imports: [
    ScheduleModule.forRoot(),
    InfrastructureModule,
    forwardRef(() => ApiModule),
  ],
  providers: [
    // Services
    PriceService,
    BurnService,
    AssetService,
    TradingSellRestrictionService, // 预种卖出限制（HTTP + Redis，fail-open）
    OrderService,
    TransferService,
    P2pTransferService,
    MarketMakerService,
    C2cService,
    C2cBotService,
    PaymentProofService,
    AuditLedgerService,
    // Schedulers
    OutboxScheduler,
    BurnScheduler,
    PriceBroadcastScheduler,
    C2cExpiryScheduler,
    C2cBotScheduler,
  ],
  exports: [OrderService, TransferService, P2pTransferService, PriceService, BurnService, AssetService, TradingSellRestrictionService, MarketMakerService, C2cService, C2cBotService, PaymentProofService, AuditLedgerService],
})
export class ApplicationModule {}
