//
//  AppTab.swift
//  suixinkan
//
//  Created by Codex on 2026/6/18.
//

import SwiftUI

/// 主 Tab 实体，描述底部导航中的每一个一级入口。
enum AppTab: String, CaseIterable, Identifiable, Hashable {
    case home
    case orders
    case statistics
    case profile

    var id: Self { self }

    var title: String {
        switch self {
        case .home:
            "首页"
        case .orders:
            "订单"
        case .statistics:
            "数据"
        case .profile:
            "我的"
        }
    }

    /// 当前 Tab 处于选中状态时使用的本地图片资源名。
    var selectedImageName: String {
        switch self {
        case .home:
            "tab_home_selected"
        case .orders:
            "tab_order_selected"
        case .statistics:
            "tab_data_selected"
        case .profile:
            "tab_profile_selected"
        }
    }

    /// 当前 Tab 处于未选中状态时使用的本地图片资源名。
    var unselectedImageName: String {
        switch self {
        case .home:
            "tab_home_unselected"
        case .orders:
            "tab_order_unselected"
        case .statistics:
            "tab_data_unselected"
        case .profile:
            "tab_profile_unselected"
        }
    }

    @ViewBuilder
    var rootView: some View {
        switch self {
        case .home:
            HomeRootView()
        case .orders:
            OrdersRootView()
        case .statistics:
            StatisticsRootView()
        case .profile:
            ProfileRootView()
        }
    }
}
