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

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

export enum ActionType {
  ReadAllByInfraVendor = '[meta.meta-vendor-crawler] ReadAllByInfraVendor',
  ReadAllByInfraVendorSuccess = '[meta.meta-vendor-crawler] ReadAllByInfraVendorSuccess',
  ReadAllByInfraVendorFailure = '[meta.meta-vendor-crawler] ReadAllByInfraVendorFailure',
}

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

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

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

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

  constructor(public payload: RPCClientError) {}
}

export type Actions =
  | ReadAllByInfraVendor
  | ReadAllByInfraVendorSuccess
  | ReadAllByInfraVendorFailure
;
