import { Injectable, OnModuleInit } from '@nestjs/common';
import { ClientGrpc, Client } from '@nestjs/microservices';
// import { Observable } from 'rxjs';
import { grpcClientOptions } from './grpc-scene.options';

@Injectable()
export class SceneService implements OnModuleInit {
  @Client(grpcClientOptions) private readonly client: ClientGrpc;
  private sceneGrpcService: SceneGrpcService;

  OnModuleInit() {
    this.sceneGrpcService =
      this.client.getService<SceneGrpcService>('SceneGrpcService');
    debugger;
  }

  getService(name: string) {
    this.sceneGrpcService = this.client.getService<SceneGrpcService>(name);
    return this.sceneGrpcService;
  }

  getRoute() {
    console.log('this.sceneGrpcService', this.sceneGrpcService);
  }
}
