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

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

export enum ActionType {
  ReadAllMetaSensorItemKeyByDisplayItem = '[meta.meta-sensor-display-mapping] ReadAllMetaSensorItemKeyByDisplayItem',
  ReadAllMetaSensorItemKeyByDisplayItemSuccess = '[meta.meta-sensor-display-mapping] ReadAllMetaSensorItemKeyByDisplayItemSuccess',
  ReadAllMetaSensorItemKeyByDisplayItemFailure = '[meta.meta-sensor-display-mapping] ReadAllMetaSensorItemKeyByDisplayItemFailure',
}

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

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

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

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

  constructor(public payload: RPCClientError) {}
}

export type Actions =
  | ReadAllMetaSensorItemKeyByDisplayItem
  | ReadAllMetaSensorItemKeyByDisplayItemSuccess
  | ReadAllMetaSensorItemKeyByDisplayItemFailure
;
