import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';

import { RPCService } from '@loafer/ng-rpc/service';
import { SensorItemDependency } from '../model/SensorItemDependency';
import { MetaSensorItemKey } from 'packages/meta/sensor-item-key/model/MetaSensorItemKey';
import { MetaSensorDisplayItem } from '../../meta/sensor-display-item/model/MetaSensorDisplayItem';



@Injectable()
export class SensorItemDependencyService {

  public constructor(
    private rpcService: RPCService,
  ) {

  }

  public regist(dependency: SensorItemDependency): Observable<SensorItemDependency> {
    return this.rpcService.call('SensorItemDependencyService.regist', dependency);
  }

  public readAllByDisplayItem(displayItem: MetaSensorDisplayItem): Observable<MetaSensorItemKey[]> {
    return this.rpcService.call('SensorItemDependencyService.readAllByDisplayItem', displayItem);
  }


}
