import { Head, usePage } from '@inertiajs/react';
import { Building2 } from 'lucide-react';

// Shown if a logged-in user somehow has no organization. In the invite-only model
// this should be rare — users join an org at invite acceptance. Platform admins are
// directed to the admin area to create/join one.
export default function Onboarding() {
    const { isPlatformAdmin } = usePage().props as unknown as { isPlatformAdmin?: boolean };

    return (
        <div className="flex min-h-dvh items-center justify-center bg-background px-6">
            <Head title="Getting started" />
            <div className="w-full max-w-md text-center">
                <span className="mx-auto flex size-12 items-center justify-center rounded-xl bg-primary/10">
                    <Building2 className="size-6 text-primary" />
                </span>
                <h1 className="mt-4 text-xl font-semibold text-foreground">No organization yet</h1>
                {isPlatformAdmin ? (
                    <>
                        <p className="mt-1 text-sm text-muted-foreground">
                            As a platform administrator, create an organization to get started.
                        </p>
                        <a href="/admin/organizations" className="mt-6 inline-block rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:opacity-90">
                            Manage organizations
                        </a>
                    </>
                ) : (
                    <p className="mt-1 text-sm text-muted-foreground">
                        Your account isn't part of an organization yet. Please contact your administrator
                        to be invited.
                    </p>
                )}
            </div>
        </div>
    );
}
