import { Action } from '@ngrx/store';

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

import { ProbeHost, Probe } from '@overflow/commons-typescript/model/probe';


export enum ActionType {
  ReadByProbe = '[probeHost.detail] Read',
  ReadByProbeSuccess = '[probeHost.detail] ReadSuccess',
  ReadByProbeFailure = '[probeHost.detail] ReadFailure',
}

export class ReadByProbe implements Action {
  readonly type = ActionType.ReadByProbe;

  constructor(public payload: Probe) {}
}

export class ReadByProbeSuccess implements Action {
  readonly type = ActionType.ReadByProbeSuccess;

  constructor(public payload: ProbeHost) {}
}

export class ReadByProbeFailure implements Action {
  readonly type = ActionType.ReadByProbeFailure;

  constructor(public payload: RPCClientError) {}
}


export type Actions =
  | ReadByProbe
  | ReadByProbeSuccess
  | ReadByProbeFailure
;
