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

import { RPCService } from '@loafer/ng-rpc';

import { Domain } from '@overflow/commons-typescript/model/domain';

import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';


@Injectable()
export class NoAuthProbeService {

  public constructor(
    private rpcService: RPCService,
  ) {

  }

  public readAllByDomainID(domainID: number): Observable<NoAuthProbe[]> {
    return this.rpcService.call<NoAuthProbe[]>('NoAuthProbeService.readAllByDomainID', domainID);
  }

  public acceptNoAuthProbe(id: number, zoneCIDR: string): Observable<NoAuthProbe> {
    return this.rpcService.call<NoAuthProbe>('NoAuthProbeService.acceptNoAuthProbe', id, zoneCIDR);
  }

  public denyNoauthProbe(id: number): Observable<NoAuthProbe> {
    return this.rpcService.call<NoAuthProbe>('NoAuthProbeService.denyNoauthProbe', id);
  }

  public read(id: number): Observable<NoAuthProbe> {
    return this.rpcService.call<NoAuthProbe>('NoAuthProbeService.read', id);
  }
}
