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

import { RPCClientError } from '@loafer/ng-rpc/protocol';

import { Domain } from '@overflow/commons-typescript/model/domain';
import { PageParams, Page } from 'app/commons/model';
import { Sensor } from '@overflow/commons-typescript/model/sensor';
import { SensorItem } from '@overflow/commons-typescript/model/sensor-item';

export enum ActionType {
  Regist = '[Sensor.Regist] Regist',
  RegistSuccess = '[Sensor.RegistSuccess] RegistSuccess',
  RegistFailure = '[Sensor.RegistFailure] RegistFailure',
}

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

  constructor(public payload: { sensor: Sensor, sensorItems: SensorItem[]}) {}
}

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

  constructor(public payload: Sensor) {}
}

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

  constructor(public payload: RPCClientError) {}
}

export type Actions =
  | Regist
  | RegistSuccess
  | RegistFailure
;
