import Actions from '../../../types/Store/Actions';
import Order, { AllOrderItem } from '../../../types/Order/Order';
export const TOGGLE_ORDER_STATE = 'TOGGLE_ORDER_STATE';
export const UPDATE_PAY_LIST = 'UPDATE_PAY_LIST';
export const UPDATE_ALL_LIST = 'UPDATE_ALL_LIST';

export type UpdateOrderParams<T> = {
  lastOrderId?: number;
  list: T[];
};

export const toggleOrderState = (state: String): Actions => ({
  type: TOGGLE_ORDER_STATE,
  payload: state,
});

export const updatePayOrderList = (
  state: UpdateOrderParams<Order>
): Actions => ({
  type: UPDATE_PAY_LIST,
  payload: state,
});
export const updateAllOrderList = (
  state: UpdateOrderParams<AllOrderItem>
): Actions => ({
  type: UPDATE_ALL_LIST,
  payload: state,
});
