import { LucideIcon } from 'lucide-react';

export interface Auth {
    user: User;
}

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

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

export interface NavItem {
    title: string;
    url: string;
    icon?: LucideIcon | null;
    isActive?: boolean;
}

export interface SiteSettings {
    site_name: string;
    tagline: string;
    logo_path: string | null;
    announcement_bar: string;
    show_announcement: boolean;
    phone: string;
    footer_desc: string;
    facebook: string;
    instagram: string;
    youtube: string;
    copyright: string;
    show_about: boolean;
    show_blog: boolean;
}

export interface SharedData {
    name: string;
    quote: { message: string; author: string };
    auth: Auth;
    admin?: AdminUser | null;
    flash?: { success?: string | null; error?: string | null };
    cartCount?: number;
    siteSettings?: SiteSettings;
    [key: string]: unknown;
}

export interface User {
    id: number;
    name: string;
    email: string;
    avatar?: string;
    email_verified_at: string | null;
    created_at: string;
    updated_at: string;
    [key: string]: unknown;
}

// ─── Admin Models ─────────────────────────────────────────────────────────────

export interface AdminUser {
    id: number;
    name: string;
    email: string;
    phone?: string;
    avatar?: string;
    status: boolean;
    role?: Role;
}

export interface Role {
    id: number;
    name: string;
    slug: string;
    admins_count?: number;
}

export interface Permission {
    id: number;
    name: string;
    slug: string;
    module: string;
}

export interface Category {
    id: number;
    name: string;
    slug: string;
    parent_id?: number;
    parent?: Category;
    icon?: string;
    image?: string;
    status: boolean;
    sort_order: number;
    deleted_at?: string;
}

export interface Banner {
    id: number;
    title?: string;
    subtitle?: string;
    image: string;
    link?: string;
    position: string;
    sort_order: number;
    status: boolean;
}

export interface Brand {
    id: number;
    name: string;
    slug: string;
    logo?: string;
    status: boolean;
    deleted_at?: string;
}

export interface ProductImage {
    id: number;
    image: string;
    sort_order: number;
    is_primary: boolean;
}

export interface AttributeValue {
    id: number;
    value: string;
    slug: string;
    attribute?: { id: number; name: string };
}

export interface Attribute {
    id: number;
    name: string;
    slug: string;
    values?: AttributeValue[];
}

export interface ProductVariant {
    id: number;
    variant_name: string;
    sku: string;
    price: string;
    cost_price: string;
    stock_qty: number;
    status: boolean;
    attribute_value_id?: number;
    attribute_values?: AttributeValue[];
}

export interface Product {
    id: number;
    product_type?: 'general' | 'fragrance';
    name: string;
    slug: string;
    sku: string;
    price: string;
    compare_price?: string;
    cost_price: string;
    stock_qty: number;
    weight?: string;
    discount_type?: 'none' | 'percent' | 'fixed';
    discount_value?: string;
    discount_label?: string;
    discount_starts_at?: string;
    discount_ends_at?: string;
    is_discount_active?: boolean;
    discount_percent?: number;
    status: boolean;
    is_featured: boolean;
    is_best_seller: boolean;
    is_trending: boolean;
    is_new_arrival: boolean;
    has_variant: boolean;
    low_stock_alert: number;
    category?: Category;
    brand?: Brand;
    images?: ProductImage[];
    variants?: ProductVariant[];
    short_description?: string;
    description?: string;
    meta_title?: string;
    meta_description?: string;
    created_at: string;
    deleted_at?: string;
}

export interface Customer {
    id: number;
    name: string;
    phone: string;
    alt_phone?: string;
    email?: string;
    total_orders: number;
    total_spent: string;
    is_blocked: boolean;
    last_order_at?: string;
    first_order_at?: string;
    notes?: string;
    orders?: Order[];
}

export interface OrderItem {
    id: number;
    product_name: string;
    sku: string;
    price: string;
    cost_price: string;
    qty: number;
    subtotal: string;
    product?: Product;
}

export interface Order {
    id: number;
    invoice_no: string;
    customer_name: string;
    customer_phone: string;
    customer_email?: string;
    shipping_address: string;
    note?: string;
    subtotal: string;
    discount_amount: string;
    shipping_charge: string;
    total_amount: string;
    payment_method: string;
    payment_status: 'unpaid' | 'paid' | 'partial' | 'refunded';
    order_status: 'new' | 'pending' | 'confirmed' | 'packed' | 'shipped' | 'delivered' | 'cancelled' | 'returned';
    ordered_at?: string;
    created_at: string;
    customer?: Customer;
    items?: OrderItem[];
}

export interface Coupon {
    id: number;
    code: string;
    type: 'fixed' | 'percent';
    value: string;
    min_order_amount: string;
    max_discount?: string;
    usage_limit?: number;
    used_count: number;
    start_at?: string;
    end_at?: string;
    status: boolean;
}

export interface Courier {
    id: number;
    name: string;
    slug: string;
    base_url?: string;
    status: boolean;
}

// ─── Pagination ───────────────────────────────────────────────────────────────

export interface PaginatedData<T> {
    data: T[];
    current_page: number;
    last_page: number;
    per_page: number;
    total: number;
    from: number;
    to: number;
    links: { url: string | null; label: string; active: boolean }[];
}
