import type { PageProps } from '@inertiajs/core';

export interface NavigationLink {
    label: string;
    href: string;
    badge?: number | null;
}

export interface NavigationItem extends NavigationLink {
    /** Key into the icon map in lib/navigation.ts. */
    icon: string;
    children: NavigationLink[];
}

export interface NavigationGroup {
    label: string | null;
    /** Shown on the settings page rather than in the sidebar. */
    secondary: boolean;
    items: NavigationItem[];
}

export interface AuthUser {
    id: string;
    name: string;
    email: string;
    role: string;
    avatar: string;
}

export interface FlashMessage {
    type: 'success' | 'info' | 'warning' | 'error';
    title: string | null;
    message: string;
}

/**
 * Props shared with every admin page by HandleInertiaRequests.
 */
export interface SharedProps extends PageProps {
    business: { name: string; logo: string };
    auth: { user: AuthUser | null };
    navigation: NavigationGroup[];
    flash: FlashMessage[];
    errors: Record<string, string>;
}
