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

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

import { Member } from '@overflow/commons-typescript/model/member';
import { PageParams, Page } from 'app/commons/model';
import { Notification } from '@overflow/commons-typescript/model/notification';

export enum ActionType {
  MarkAsRead = '[Notification.notification] MarkAsRead',
  MarkAsReadSuccess = '[Notification.notification] MarkAsReadSuccess',
  MarkAsReadFailure = '[Notification.notification] MarkAsReadFailure',
  // ReadUnconfirmedCount = '[Notification.notification] ReadUnconfirmedCount',
  // ReadUnconfirmedCountSuccess = '[Notification.notification] ReadUnconfirmedCountSuccess',
  // ReadUnconfirmedCountFailure = '[Notification.notification] ReadUnconfirmedCountFailure',
}

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

  constructor(public payload: Notification ) {}
}

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

  constructor(public payload: Notification) {}
}

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

  constructor(public payload: RPCClientError) {}
}

// export class ReadUnconfirmedCount implements Action {
//   readonly type = ActionType.ReadUnconfirmedCount;

//   constructor(public payload: Member) {}
// }

// export class ReadUnconfirmedCountSuccess implements Action {
//   readonly type = ActionType.ReadUnconfirmedCountSuccess;

//   constructor(public payload: number) {}
// }

// export class ReadUnconfirmedCountFailure implements Action {
//   readonly type = ActionType.ReadUnconfirmedCountFailure;

//   constructor(public payload: RPCClientError) {}
// }

export type Actions =
  | MarkAsRead
  | MarkAsReadSuccess
  | MarkAsReadFailure
  // | ReadUnconfirmedCount
  // | ReadUnconfirmedCountSuccess
  // | ReadUnconfirmedCountFailure
;
