package com.placeholder.sherpai2.ui.navigation

import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.Label
import androidx.compose.material.icons.filled.*
import androidx.compose.ui.graphics.vector.ImageVector

/**
 * AppDestinations - Navigation metadata for drawer UI
 *
 * Clean, organized structure:
 * - Routes for navigation
 * - Icons for visual identity
 * - Labels for display
 * - Descriptions for clarity
 * - Grouped by function
 */
sealed class AppDestinations(
    val route: String,
    val icon: ImageVector,
    val label: String,
    val description: String = ""
) {

    // ==================
    // PHOTO BROWSING
    // ==================

    data object Search : AppDestinations(
        route = AppRoutes.SEARCH,
        icon = Icons.Default.Search,
        label = "Search",
        description = "Find photos by tag or person"
    )

    data object Explore : AppDestinations(
        route = AppRoutes.EXPLORE,
        icon = Icons.Default.Explore,
        label = "Explore",
        description = "Browse smart albums"
    )

    data object Collections : AppDestinations(
        route = AppRoutes.COLLECTIONS,
        icon = Icons.Default.Collections,
        label = "Collections",
        description = "Your photo collections"
    )

    // ImageDetail is not in drawer (internal navigation only)

    // ==================
    // FACE RECOGNITION
    // ==================

    data object Discover : AppDestinations(
        route = AppRoutes.DISCOVER,
        icon = Icons.Default.AutoAwesome,
        label = "Discover",
        description = "Find people in your photos"
    )

    data object Inventory : AppDestinations(
        route = AppRoutes.INVENTORY,
        icon = Icons.Default.Face,
        label = "People",
        description = "Manage recognized people"
    )

    data object Train : AppDestinations(
        route = AppRoutes.TRAIN,
        icon = Icons.Default.ModelTraining,
        label = "Train Model",
        description = "Create a new person model"
    )

    // ==================
    // ORGANIZATION
    // ==================

    data object Tags : AppDestinations(
        route = AppRoutes.TAGS,
        icon = Icons.AutoMirrored.Filled.Label,
        label = "Tags",
        description = "Manage photo tags"
    )

    data object UTILITIES : AppDestinations(
        route = AppRoutes.UTILITIES,
        icon = Icons.Default.UploadFile,
        label = "Upload",
        description = "Add new photos"
    )

    // ==================
    // SETTINGS
    // ==================

    data object Settings : AppDestinations(
        route = AppRoutes.SETTINGS,
        icon = Icons.Default.Settings,
        label = "Settings",
        description = "App preferences"
    )
}

/**
 * Organized destination groups for beautiful drawer sections
 */

// Photo browsing section
val photoDestinations = listOf(
    AppDestinations.Search,
    AppDestinations.Explore,
    AppDestinations.Collections
)

// Face recognition section
val faceRecognitionDestinations = listOf(
    AppDestinations.Discover,  // ✨ NEW: Auto-cluster discovery
    AppDestinations.Inventory,
    AppDestinations.Train
)

// Organization section
val organizationDestinations = listOf(
    AppDestinations.Tags,
    AppDestinations.UTILITIES
)

// Settings (separate, pinned to bottom)
val settingsDestination = AppDestinations.Settings

/**
 * All drawer items (excludes Settings which is handled separately)
 */
val allMainDrawerDestinations = photoDestinations + faceRecognitionDestinations + organizationDestinations

/**
 * Helper function to get destination by route
 * Useful for highlighting current route in drawer
 */
fun getDestinationByRoute(route: String?): AppDestinations? {
    return when (route) {
        AppRoutes.SEARCH -> AppDestinations.Search
        AppRoutes.EXPLORE -> AppDestinations.Explore
        AppRoutes.COLLECTIONS -> AppDestinations.Collections
        AppRoutes.DISCOVER -> AppDestinations.Discover
        AppRoutes.INVENTORY -> AppDestinations.Inventory
        AppRoutes.TRAIN -> AppDestinations.Train
        AppRoutes.TAGS -> AppDestinations.Tags
        AppRoutes.UTILITIES -> AppDestinations.UTILITIES
        AppRoutes.SETTINGS -> AppDestinations.Settings
        else -> null
    }
}