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

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

export enum ActionType {
  ReadAllByMetaCrawler = '[meta.meta-crawler-input-item] ReadAllByMetaCrawler',
  ReadAllByMetaCrawlerSuccess = '[meta.meta-crawler-input-item] ReadAllByMetaCrawlerSuccess',
  ReadAllByMetaCrawlerFailure = '[meta.meta-crawler-input-item] ReadAllByMetaCrawlerFailure',
}

export class ReadAllByMetaCrawler implements Action {
  readonly type = ActionType.ReadAllByMetaCrawler;
  constructor(public payload: MetaCrawler) {}
}

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

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

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

  constructor(public payload: RPCClientError) {}
}

export type Actions =
  | ReadAllByMetaCrawler
  | ReadAllByMetaCrawlerSuccess
  | ReadAllByMetaCrawlerFailure
;
