import React from 'react';
import { AppBase } from '../app/AppBase';
import { Route } from '../app/routing/route.interface';
import { ApphouseTheme } from '../styles/defaults/themes.interface';
import { FeedbackType } from '../models/Feedback';

export interface IApphouseThemeProvider {
  theme?: ApphouseTheme;
  mode?: 'light' | 'dark' | 'custom' | string;
  children?: React.ReactNode;
}

export interface ApphouseContentWrapperProps {
  app: AppBase;
  children: React.ReactNode;
}

/**
 * Interface for the store with base
 */
export type IStoreWithBase<T> = T & {
  uuid: string;
  app: AppBase;
  theme: ApphouseTheme;
  path: string;
  open: (path?: string, title?: string, callback?: () => void) => void;
  openPopup: (popup: JSX.Element) => void;
  routes: Route[];
  closePopup: (popupId?: string) => void;
  alert: (feedback: FeedbackType) => void;
};

export type Routes<T> = (appStore: IStoreWithBase<T>) => {
  [key: string]: unknown;
};

export interface IApphouseProvider<T> {
  children: React.ReactNode;
  store?: IStoreWithBase<T>;
  routes?: Routes<T>;
}
