const fs = require("fs");
const path = require("path");

const data = [
  { path: "/admin/edit-cms/:id", element: `<EditAdminCmsPage />` },
  { path: "/admin/edit-email/:id", element: `<EditAdminEmailPage />` },
  { path: "/admin/add-sow", element: `<AddAdminSowTablePage />` },
  { path: "/admin/edit-sow/:id", element: `<EditAdminSowTablePage />` },
  { path: "/admin/view-sow/:id", element: `<ViewAdminSowTablePage />` },
  { path: "/admin/ask-gpt/:id", element: `<AskGptAdminSowTablePage />` },
  { path: "/admin/requirements", element: `<ListAdminSowTablePage />` },
  { path: "/admin/requirement/:id", element: `<PrewireframeFlow />` },
  { path: "/admin/add-setting", element: `<AddAdminSettingTablePage />` },
  { path: "/admin/edit-setting/:id", element: `<EditAdminSettingTablePage />` },
  { path: "/admin/view-setting/:id", element: `<ViewAdminSettingTablePage />` },
  { path: "/admin/setting", element: `<ListAdminSettingTablePage />` },
  { path: "/admin/add-wireframe", element: `<AddAdminWireframeTablePage />` },
  {
    path: "/admin/view-wireframe/:id",
    element: `<ViewAdminWireframeTablePage />`,
  },
  { path: "/admin/build", element: `<ListAdminWireframeTablePage />` },
  { path: "/admin/add-project", element: `<AddAdminProjectTablePage />` },
  { path: "/admin/edit-project/:id", element: `<EditAdminProjectTablePage />` },
  { path: "/admin/view-project/:id", element: `<ViewAdminProjectTablePage />` },
  { path: "/admin/generate-ui/:component", element: `<AdminGenerateUiPage />` },
  { path: "/admin/baas", element: `<AdminBaasPage />` },
  { path: "/admin/project", element: `<ListAdminProjectTablePage />` },
  { path: "/admin/users", element: `<AdminUserListPage />` },
  { path: "/admin/add-user", element: `<AddAdminUserPage />` },
  { path: "/admin/edit-user/:id", element: `<EditAdminUserPage />` },
  { path: "/admin/add-android", element: `<AddAdminAndroidPage />` },
  { path: "/admin/prices", element: `<AdminStripePricesListPage />` },
  { path: "/admin/payments", element: `<StripePayments />` },
  {
    path: "/admin/edit-product/:id",
    element: `<EditAdminStripeProductPage />`,
  },
  { path: "/admin/edit-price/:id", element: `<EditAdminStripePricePage />` },
  { path: "/admin/add-product", element: `<AddAdminStripeProductPage />` },
  { path: "/admin/add-price", element: `<AddAdminStripePricePage />` },
  { path: "/admin/products", element: `<AdminStripeProductsListPage />` },
  {
    path: "/admin/subscriptions",
    element: `<AdminStripeSubscriptionsListPage />`,
  },
  {
    path: "/admin/pending_cancel_requests",
    element: `<AdminStripeUnSubscribeListPage />`,
  },
  { path: "/admin/invoices", element: `<AdminStripeInvoicesListPageV2 />` },
  { path: "/admin/orders", element: `<AdminStripeOrdersListPage />` },
  { path: "/admin/deployment", element: `<ListAdminDeploymentTablePage />` },
  {
    path: "/admin/view-deployment/:id",
    element: `<ViewAdminDeploymentTablePage />`,
  },
  { path: "/user/checkout", element: `<CheckoutPage />` },
  {
    path: "/admin/edit-wireframe/:id",
    element: `<WireframeBuilderProvider>
  <EditWireframePage />
</WireframeBuilderProvider>
`,
  },
];

const newData = data.map((item) => {
  return `
            
        <Route
          exact
          path="${item.path}"
          element={
            <PrivateRoute
              access="admin"
              path={"${item.path}"}
              element={
                <AdminWrapper>
                  ${item.element}
                </AdminWrapper>
              }
            />
          }
        />
    `;
});

fs.writeFileSync("routes.jsx", newData.join("\n"), { encoding: "utf-8" });
