import { A, useLocation } from '@solidjs/router';
import { createMemo } from 'solid-js';

export default function OnboardingManagementTabs() {
  const location = useLocation();
  const pathname = createMemo(() => location.pathname);
  const onList = createMemo(() => pathname() === '/admin/onboarding-schemas');
  const onCreate = createMemo(() => pathname() === '/admin/onboarding-schemas/new');
  const onRoleMapping = createMemo(() => pathname() === '/admin/runtime-roles' || pathname().startsWith('/admin/runtime-roles/') || pathname() === '/admin/role-ui-configs');

  return (
    <div class="admin-link-tabs" style="margin-top:0">
      <A class={`admin-link-tab ${onList() ? 'active' : ''}`} href="/admin/onboarding-schemas">View Flows</A>
      <A class={`admin-link-tab ${onCreate() ? 'active' : ''}`} href="/admin/onboarding-schemas/new">Create Flow</A>
      <A class={`admin-link-tab ${onRoleMapping() ? 'active' : ''}`} href="/admin/runtime-roles">Role Mapping</A>
    </div>
  );
}
