import { Module } from '@nestjs/common';
import { ClientsModule, Transport } from '@nestjs/microservices';
import { join } from 'path';

@Module({
  imports: [
    ClientsModule.register([
      {
        name: 'MATTERS_SERVICE',
        transport: Transport.GRPC,
        options: { package: 'matters_service', protoPath: join(__dirname, '../proto/matters_service.proto'), url: 'matters-service:5001' },
      },
      {
        name: 'TIME_ENTRY_SERVICE',
        transport: Transport.GRPC,
        options: { package: 'time_entry_service', protoPath: join(__dirname, '../proto/time_entry_service.proto'), url: 'time-entry-service:5002' },
      },
      {
        name: 'TRUST_SERVICE',
        transport: Transport.GRPC,
        options: { package: 'trust_service', protoPath: join(__dirname, '../proto/trust_service.proto'), url: 'trust-service:5003' },
      },
      {
        name: 'HEARINGS_SERVICE',
        transport: Transport.GRPC,
        options: { package: 'hearings_service', protoPath: join(__dirname, '../proto/hearings_service.proto'), url: 'hearings-service:5005' },
      },
      {
        name: 'AUTH_SERVICE',
        transport: Transport.GRPC,
        options: { package: 'auth_service', protoPath: join(__dirname, '../proto/auth_service.proto'), url: 'auth-service:5010' },
      },
    ]),
  ],
})
export class AppModule {}
