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

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

export enum ActionType {
  ReadAllByOs = '[meta.meta-probe-package] ReadAllByOs',
  ReadAllByOsSuccess = '[meta.meta-probe-package] ReadAllByOsSuccess',
  ReadAllByOsFailure = '[meta.meta-probe-package] ReadAllByOsFailure',
}

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

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

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

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

  constructor(public payload: RPCClientError) {}
}

export type Actions =
  | ReadAllByOs
  | ReadAllByOsSuccess
  | ReadAllByOsFailure
;
