import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { RPCService } from '@loafer/ng-rpc';
import { MetaTargetType, MetaInfraType } from '@overflow/commons-typescript/model/meta';

@Injectable()
export class MetaTargetTypeService {

  public constructor(
    private rpcService: RPCService,
  ) {

  }

  public readByKey(key: string): Observable<MetaTargetType> {
    return this.rpcService.call<MetaTargetType>('MetaTargetTypeService.readByKey', key);
  }

  public readAll(): Observable<MetaTargetType[]> {
    return this.rpcService.call<MetaTargetType[]>('MetaTargetTypeService.readAll');
  }

  public readAllByMetaInfraTypeKey(key: string): Observable<MetaTargetType[]> {
    return this.rpcService.call<MetaTargetType[]>('MetaTargetTypeService.readAllByMetaInfraTypeKey', key);
  }
}
