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

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

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


export enum ActionType {
  ReadAllByDomain = '[probe.list] ReadAllByDomain',
  ReadAllByDomainSuccess = '[probe.list] ReadAllByDomainSuccess',
  ReadAllByDomainFailure = '[probe.list] ReadAllByDomainFailure',
}

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

  constructor(public payload: Domain) {}
}

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

  constructor(public payload: Probe[]) {}
}

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

  constructor(public payload: RPCClientError) {}
}


export type Actions =
  | ReadAllByDomain
  | ReadAllByDomainSuccess
  | ReadAllByDomainFailure
;
