import {
  createBrowserRouter,
  RouterProvider,
} from "react-router-dom";
import './App.css'
import { NotificationProvider } from "./context/NotificationContext";

//pages
import PageBase from "./pages/PageBase/PageBase";
import NewCliente from "./pages/Cliente/NewCliente";
import { notification } from "antd";
import { IconType } from "antd/es/notification/interface";

const router = createBrowserRouter([
  {
    path: "/",
    element: <PageBase/>,
    children:[
      {
        path:"/cliente/new",
        element: <NewCliente/>
      }
    ]
  },

]);

function App() {

  const [api, contextHolder] = notification.useNotification();

   const openNotification = (message:string, description:string, type:IconType) => {
    api.open({
      type:type, 
      message: message,
      description: description,
    });
  };
  
  return (
  <div className='App'>
    <NotificationProvider value={{openNotification}} >
      {contextHolder}
      <RouterProvider router={router}/>
      </NotificationProvider>
  </div>
  )
}

export default App
