import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';

// Entities (Main)
import { ContractDrawing } from './entities/contract-drawing.entity';
import { ShopDrawing } from './entities/shop-drawing.entity';
import { ShopDrawingRevision } from './entities/shop-drawing-revision.entity';
import { AsBuiltDrawing } from './entities/asbuilt-drawing.entity';
import { AsBuiltDrawingRevision } from './entities/asbuilt-drawing-revision.entity';

// Entities (Master Data - Contract Drawing)
import { ContractDrawingVolume } from './entities/contract-drawing-volume.entity';
import { ContractDrawingSubCategory } from './entities/contract-drawing-sub-category.entity';

// Entities (Master Data - Shop Drawing) - ✅ เพิ่มใหม่
import { ContractDrawingSubcatCatMap } from './entities/contract-drawing-subcat-cat-map.entity';
import { ContractDrawingCategory } from './entities/contract-drawing-category.entity';
import { ShopDrawingMainCategory } from './entities/shop-drawing-main-category.entity';
import { ShopDrawingSubCategory } from './entities/shop-drawing-sub-category.entity';

// Common Entities
import { Attachment } from '../../common/file-storage/entities/attachment.entity';

// Services
import { ShopDrawingService } from './shop-drawing.service';
import { ContractDrawingService } from './contract-drawing.service';
import { AsBuiltDrawingService } from './asbuilt-drawing.service';
import { DrawingMasterDataService } from './drawing-master-data.service';

// Controllers
import { ShopDrawingController } from './shop-drawing.controller';
import { ContractDrawingController } from './contract-drawing.controller';
import { AsBuiltDrawingController } from './asbuilt-drawing.controller';
import { DrawingMasterDataController } from './drawing-master-data.controller';

// Modules
import { FileStorageModule } from '../../common/file-storage/file-storage.module';
import { UserModule } from '../user/user.module';

@Module({
  imports: [
    TypeOrmModule.forFeature([
      // Main
      ContractDrawing,
      ShopDrawing,
      ShopDrawingRevision,
      AsBuiltDrawing,
      AsBuiltDrawingRevision,

      // Master Data
      ContractDrawingVolume,
      ContractDrawingSubCategory,
      ContractDrawingSubcatCatMap,
      ContractDrawingCategory,
      ShopDrawingMainCategory,
      ShopDrawingSubCategory,

      // Common
      Attachment,
    ]),
    FileStorageModule,
    UserModule,
  ],
  providers: [
    ShopDrawingService,
    ContractDrawingService,
    AsBuiltDrawingService,
    DrawingMasterDataService,
  ],
  controllers: [
    ShopDrawingController,
    ContractDrawingController,
    AsBuiltDrawingController,
    DrawingMasterDataController,
  ],
  exports: [ShopDrawingService, ContractDrawingService, AsBuiltDrawingService],
})
export class DrawingModule {}
