import { Locations, TicketTypeTarrifs, TicketTypeTypes } from './enums';

export interface SidebarProps {
  sidebarItems: TSidebarItem[];
}

export interface TSidebarItem {
  label: string;
  icon: JSX.Element;
  url: Locations;
  [key: string]: any;
}

export interface NavbarProps {
  navbarItems: TNavbarItem[];
}

export interface TNavbarItem {
  label: string;
  key: string;
  [key: string]: any;
}

export interface TicketType {
  id: string;
  type: TicketTypeTypes;
  tariff: TicketTypeTarrifs;
  label: string;
  price: number;
}

export interface User {
  firstName: string;
  surName: string;
  login: string;
  role: string;
}

export interface SelectOption {
  value: any;
  label: string;
}

export interface AppContextContent {
  component: string;
}

export type AppContextState = {
  content: AppContextContent;
  sell: {
    ticketTypes: TicketType[];
    finalPrice: number;
  };
};

export interface AppContextProps {
  state: AppContextState;
  dispatch: AppContextDispach;
}

export type AppContextProviderProps = {
  children: JSX.Element;
};

export type ContentSetAction = {
  type: 'content/set';
  payload: string;
};

export type TicketAddAction = {
  type: 'ticket/add';
  payload: TicketType;
};

export type TicketRemoveAction = {
  type: 'ticket/remove';
  payload: TicketType;
};

export type AppContextAction =
  | ContentSetAction
  | TicketAddAction
  | TicketRemoveAction;

export type AppContextDispach = (action: AppContextAction) => void;
