import { LucideIcon } from 'lucide-react';
import type { Config } from 'ziggy-js';

export interface Auth {
    user: User;
}

export interface BreadcrumbItem {
    title: string;
    href: string;
}

export interface NavGroup {
    title: string;
    items: NavItem[];
}

export interface NavItem {
    title: string;
    href: string;
    icon?: LucideIcon | null;
    isActive?: boolean;
    items?: NavItem[];
}

export interface SidebarThemeColors {
    background: string;
    foreground: string;
    primary: string;
    accent: string;
    accentForeground?: string;
    border: string;
}

export interface SidebarTheme {
    theme: string;
    colors: SidebarThemeColors;
    respectsSystemTheme: boolean;
}

export interface SharedData {
    name: string;
    appName?: string;
    appLogoUrl?: string | null;
    appLogoWebP?: string | null;
    appFont?: string;
    quote: { message: string; author: string };
    auth: Auth;
    ziggy: Config & { location: string };
    sidebarOpen: boolean;
    sidebarTheme?: SidebarTheme;
    socialMedia?: {
        discord?: { enabled: boolean; url: string };
        tiktok?: { enabled: boolean; url: string };
        youtube?: { enabled: boolean; url: string };
        [key: string]: any;
    };
    [key: string]: unknown;
}

export interface User {
    id: number;
    ID: number; // Laravel uses uppercase ID as primary key
    name: string;
    truename?: string;
    email: string;
    avatar?: string;
    photo?: string;
    email_verified_at: string | null;
    created_at: string;
    updated_at: string;
    role?: string | Role; // Can be string 'admin' or Role object
    roles?: Role[]; // For when roles are eager loaded
    gold?: number;
    qq?: string;
    mobilenumber?: string;
    [key: string]: unknown; // This allows for additional properties...
}

export interface Flash {
    success?: string;
    error?: string;
    info?: string;
    warning?: string;
}

export interface PermissionNavDefinition {
    permission: string;
    item: NavItem;
}

export interface Role {
    id: string;
    name: string;
    permissions?: Permission[];
}

export interface Permission {
    id: string;
    name: string;
}
