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

import { RPCClientError } from '@loafer/ng-rpc/protocol';
import { MetaCrawler } from '@overflow/commons-typescript/model/meta';
import { MetaCrawlerInputItem } from '@overflow/commons-typescript/model/meta';


export enum ActionType {
  ReadAll = '[meta.crawler-input-list] ReadAll',
  ReadAllSuccess = '[meta.crawler-input-list] ReadAllSuccess',
  ReadAllFailure = '[meta.crawler-input-list] ReadAllFailure',
}

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

  constructor(public payload: MetaCrawler) {}
}

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

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

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

  constructor(public payload: RPCClientError) {}
}

export type Actions =
  | ReadAll
  | ReadAllSuccess
  | ReadAllFailure

;
