import { Module } from '@nestjs/common';
import { MerchantController } from './merchant.controller';
import { MerchantService } from './merchant.service';
import { ConfigModule } from '@nestjs/config';
import { TypeOrmSharedModule } from '@app/typeorm';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Merchant } from './merchant.entity';

import { StaticFileModule } from '@app/static-file';
import { LocationModule } from './location/location.module';
import { MerchantdocumentsController } from './merchantdocuments/merchantdocuments.controller';
import { MerchantdocumentsModule } from './merchantdocuments/merchantdocuments.module';
import { MerchantdocumentsService } from './merchantdocuments/merchantdocuments.service';
import { MerchanttypeModule } from './merchanttype/merchanttype.module';
import { MerchantcategoryModule } from './merchantcategory/merchantcategory.module';
import { MerchantHasCategoryModule } from './merchant-has-category/merchant-has-category.module';
import { MerchantHasCategoryService } from './merchant-has-category/merchant-has-category.service';
import { MerchantlogModule } from './merchantlog/merchantlog.module';
import { ClientsModule, Transport } from '@nestjs/microservices';

@Module({
  imports: [
    ClientsModule.register([
      {
        name: 'SHOP_SERVICE',
        transport: Transport.TCP,
        options: {
          host: 'localhost', // 👈 Use correct host of Shop microservice
          port: 8881, // 👈 Use correct port of Shop microservice
        },
      },
    ]),
    // other modules if needed...

    ConfigModule.forRoot(),
    TypeOrmSharedModule,
    TypeOrmModule.forFeature([Merchant]),
    StaticFileModule,
    LocationModule,
    MerchantdocumentsModule,
    MerchanttypeModule,
    MerchantcategoryModule,
    MerchantHasCategoryModule,
    MerchantlogModule,
  ],
  controllers: [MerchantController],
  providers: [MerchantService],
})
export class MerchantModule {}
