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

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

export enum ActionType {
  ReadAllByMetaInfraType = '[meta.meta-infra-vendor] ReadAllByMetaInfraType',
  ReadAllByMetaInfraTypeSuccess = '[meta.meta-infra-vendor] ReadAllByMetaInfraTypeSuccess',
  ReadAllByMetaInfraTypeFailure = '[meta.meta-infra-vendor] ReadAllByMetaInfraTypeFailure',
}

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

  constructor(public payload: MetaInfraType) {}
}

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

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

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

  constructor(public payload: RPCClientError) {}
}

export type Actions =
  | ReadAllByMetaInfraType
  | ReadAllByMetaInfraTypeSuccess
  | ReadAllByMetaInfraTypeFailure
;
