import Router from "preact-router";
import { pageState } from "./globalPageState";

import { DeleteSecretsEngine } from "./ui/pages/Secrets/DeleteSecretsEngine";
import { Home } from "./ui/pages/Home";
import { KeyValueDelete } from "./ui/pages/Secrets/KeyValue/KeyValueDelete";
import { KeyValueView } from "./ui/pages/Secrets/KeyValue/KeyValueView";
import { KeyValueEdit } from "./ui/pages/Secrets/KeyValue/KeyValueEdit";
import { KeyValueList } from "./ui/pages/Secrets/KeyValue/KeyValueList";
import { Login } from "./ui/pages/Login";
import { Me } from "./ui/pages/Me";
import { NewKVEngine } from "./ui/pages/Secrets/NewEngines/NewKVEngine";
import { NewSecretsEngine } from "./ui/pages/Secrets/NewSecretsEngine";
import { NewTOTPEngine } from "./ui/pages/Secrets/NewEngines/NewTOTPEngine";
import { NewTransitEngine } from "./ui/pages/Secrets/NewEngines/NewTransitEngine";
import { TransitNew } from "./ui/pages/Secrets/Transit/TransitNew";
import { PasswordGenerator } from "./ui/pages/PwGen";
import { Secrets } from "./ui/pages/Secrets/SecretsHome";
import { SetLanguage } from "./ui/pages/SetLanguage";
import { SetVaultURL } from "./ui/pages/SetVaultURL";
import { TOTPDelete } from "./ui/pages/Secrets/TOTP/TOTPDelete";
import { TOTPNew } from "./ui/pages/Secrets/TOTP/TOTPNew";
import { TOTPList } from "./ui/pages/Secrets/TOTP/TOTPList";
import { TransitList } from "./ui/pages/Secrets/Transit/TransitList";
import { TransitView } from "./ui/pages/Secrets/Transit/TransitView";
import { Unseal } from "./ui/pages/Unseal";
import { KeyValueNew } from "./ui/pages/Secrets/KeyValue/KeyValueNew";
import { TransitDecrypt } from "./ui/pages/Secrets/Transit/TransitDecrypt";
import { TransitEncrypt } from "./ui/pages/Secrets/Transit/TransitEncrypt";
import { TransitRewrap } from "./ui/pages/Secrets/Transit/TransitRewrap";
import { PoliciesHome } from "./ui/pages/Policies/PoliciesHome";
import { PolicyView } from "./ui/pages/Policies/PolicyView";
import { PolicyNew } from "./ui/pages/Policies/PolicyNew";
import { PolicyDelete } from "./ui/pages/Policies/PolicyDelete";
import { PolicyEdit } from "./ui/pages/Policies/PolicyEdit";
import { AuthHome } from "./ui/pages/Access/Auth/AuthHome";
import { AccessHomePage } from "./ui/pages/Access/AccessHome";
import { AuthViewConfig } from "./ui/pages/Access/Auth/AuthViewConfig";
import { UserPassUsersList } from "./ui/pages/Access/Auth/userpass/UserPassUsersList";
import { UserPassUserDelete } from "./ui/pages/Access/Auth/userpass/UserPassUserDelete";
import { UserPassUserView } from "./ui/pages/Access/Auth/userpass/UserPassUserView";
import { UserPassUserNew } from "./ui/pages/Access/Auth/userpass/UserPassUserNew";
import { UserPassUserEdit } from "./ui/pages/Access/Auth/userpass/UserPassUserEdit";

export const Main = () => (
  <Router>
    <Home path="/" state={pageState} />
    <Me path="/me" state={pageState} />
    <Login path="/login" state={pageState} />
    <PasswordGenerator path="/pw_gen" />
    <SetVaultURL path="/set_vault_url" state={pageState} />
    <Unseal path="/unseal" state={pageState} />
    <SetLanguage path="/set_language" state={pageState} />

    <Secrets path="/secrets" state={pageState} />
    <DeleteSecretsEngine path="/secrets/delete_engine/:mount" state={pageState} />

    <NewSecretsEngine path="/secrets/new_secrets_engine" />
    <NewKVEngine path="/secrets/new_secrets_engine/kv" />
    <NewTOTPEngine path="/secrets/new_secrets_engine/totp" />
    <NewTransitEngine path="/secrets/new_secrets_engine/trasit" />

    <KeyValueNew path="/secrets/kv/new/:baseMount/:secretPath*?" state={pageState} />
    <KeyValueList path="/secrets/kv/list/:baseMount/:secretPath*?" state={pageState} />
    <KeyValueView path="/secrets/kv/view/:item/:baseMount/:secretPath*?" state={pageState} />
    <KeyValueEdit path="/secrets/kv/edit/:item/:baseMount/:secretPath*?" state={pageState} />
    <KeyValueDelete path="/secrets/kv/delete/:item/:baseMount/:secretPath*?" state={pageState} />

    <TOTPList path="/secrets/totp/list/:baseMount" state={pageState} />
    <TOTPNew path="/secrets/totp/new/:baseMount" state={pageState} />
    <TOTPDelete path="/secrets/totp/delete/:baseMount/:item" state={pageState} />

    <TransitNew path="/secrets/transit/new/:baseMount" state={pageState} />
    <TransitList path="/secrets/transit/list/:baseMount" state={pageState} />
    <TransitView path="/secrets/transit/view/:baseMount/:secretItem" state={pageState} />
    <TransitEncrypt path="/secrets/transit/encrypt/:baseMount/:secretItem" state={pageState} />
    <TransitDecrypt path="/secrets/transit/decrypt/:baseMount/:secretItem" state={pageState} />
    <TransitRewrap path="/secrets/transit/rewrap/:baseMount/:secretItem" state={pageState} />

    <PoliciesHome path="/policies" state={pageState} />
    <PolicyNew path="/policies/new" state={pageState} />
    <PolicyView path="/policies/view/:policyName" state={pageState} />
    <PolicyEdit path="/policies/edit/:policyName" state={pageState} />
    <PolicyDelete path="/policies/delete/:policyName" state={pageState} />

    <AccessHomePage path="/access" state={pageState} />
    <AuthHome path="/access/auth" state={pageState} />
    <AuthViewConfig path="/access/auth/view/:baseMount" state={pageState} />

    <UserPassUsersList path="/access/auth/userpass/list/:baseMount" state={pageState} />
    <UserPassUserNew path="/access/auth/userpass/new/:baseMount" state={pageState} />
    <UserPassUserView path="/access/auth/userpass/view/:baseMount/:user" state={pageState} />
    <UserPassUserEdit path="/access/auth/userpass/edit/:baseMount/:user" state={pageState} />
    <UserPassUserDelete path="/access/auth/userpass/delete/:baseMount/:user" state={pageState} />

    <div default>
      <p>PAGE NOT YET IMPLEMENTED</p>
    </div>
  </Router>
);
