// EN: Sidebar menu configuration per shop vertical (Café, Restaurant, Karaoke, Spa).
// VI: Cấu hình menu sidebar theo ngành hàng (Café, Nhà hàng, Karaoke, Spa).

namespace WebClientTpos.Client.Services;

/// <summary>
/// EN: Static config for shop-level sidebar menus per vertical type.
///     Labels are i18n keys — resolved at render time via IStringLocalizer.
/// VI: Cấu hình tĩnh cho menu sidebar cấp cửa hàng theo loại ngành hàng.
///     Labels là i18n keys — được resolve lúc render qua IStringLocalizer.
///
/// Mỗi ngành hàng có menu khác nhau:
///   - Café: Menu đồ uống, tồn kho nguyên liệu
///   - Restaurant: Menu món ăn + Bàn + Bếp
///   - Karaoke: Phòng + Menu bar
///   - Spa: Lịch hẹn + Dịch vụ
/// Tất cả đều có: Tài chính, Nhân sự, Khách hàng, Báo cáo
/// </summary>
public static class ShopSidebarConfig
{
    public record MenuItem(string Label, string Icon, string Route, bool IsSub = false);

    /// <summary>
    /// EN: Get sidebar menu items for a specific shop vertical.
    ///     Labels are i18n keys (e.g. "Shop_Menu_Overview").
    /// VI: Lấy danh sách menu sidebar cho ngành hàng cụ thể.
    ///     Labels là i18n keys (ví dụ "Shop_Menu_Overview").
    /// </summary>
    public static List<MenuItem> GetMenuItems(string? category)
    {
        var vertical = ShopVerticalHelper.NormalizeVertical(category);

        // EN: Shared menu items used by all verticals
        // VI: Menu items dùng chung cho tất cả ngành hàng
        List<MenuItem> CommonTail() => new()
        {
            new("Shop_Menu_Finance", "trending-up", "finance"),
            new("Shop_Menu_Staff", "users", "staff"),
            new("Shop_Menu_Attendance", "clock", "attendance", true),
            new("Shop_Menu_LeaveRequests", "calendar-off", "leave-requests", true),
            new("Shop_Menu_Customers", "heart", "customers"),
            new("Shop_Menu_Promotions", "tag", "promotions"),
            new("Shop_Menu_Reports", "bar-chart-2", "reports"),
            new("Shop_Menu_AiChat", "bot", "ai-chat"),
            new("Shop_Menu_Drive", "hard-drive", "drive"),
            new("Shop_Menu_Settings", "settings", "settings"),
        };

        List<MenuItem> items = vertical switch
        {
            "cafe" => new()
            {
                new("Shop_Menu_Overview", "layout-dashboard", "overview"),
                new("Shop_Menu_POS", "monitor", "pos"),
                new("Shop_Menu_MenuDrinks", "coffee", "menu"),
                new("Shop_Menu_Recipes", "flask-conical", "recipes"),
                new("Shop_Menu_Shifts", "clock-4", "shifts"),
                new("Shop_Menu_Inventory", "warehouse", "inventory"),
            },
            "restaurant" => new()
            {
                new("Shop_Menu_Overview", "layout-dashboard", "overview"),
                new("Shop_Menu_POS", "monitor", "pos"),
                new("Shop_Menu_MenuFood", "utensils", "menu"),
                new("Shop_Menu_Tables", "grid-3x3", "tables"),
                new("Shop_Menu_Reservations", "calendar-check", "reservations"),
                new("Shop_Menu_Zones", "map-pin", "zones"),
                new("Shop_Menu_Kitchen", "flame", "kitchen"),
                new("Shop_Menu_Inventory", "warehouse", "inventory"),
            },
            "karaoke" => new()
            {
                new("Shop_Menu_Overview", "layout-dashboard", "overview"),
                new("Shop_Menu_POS", "monitor", "pos"),
                new("Shop_Menu_Rooms", "door-open", "rooms"),
                new("Shop_Menu_MenuBar", "wine", "menu"),
                new("Shop_Menu_HappyHour", "clock", "happy-hour"),
                new("Shop_Menu_Inventory", "warehouse", "inventory"),
            },
            "spa" => new()
            {
                new("Shop_Menu_Overview", "layout-dashboard", "overview"),
                new("Shop_Menu_POS", "monitor", "pos"),
                new("Shop_Menu_Appointments", "calendar", "appointments"),
                new("Shop_Menu_Therapists", "user-check", "therapists"),
                new("Shop_Menu_Services", "sparkles", "services"),
                new("Shop_Menu_Packages", "gift", "packages"),
                new("Shop_Menu_Combos", "layers", "combos"),
                new("Shop_Menu_Resources", "door-open", "resources"),
                new("Shop_Menu_Products", "package", "products"),
            },
            "beauty" => new()
            {
                new("Shop_Menu_Overview", "layout-dashboard", "overview"),
                new("Shop_Menu_POS", "monitor", "pos"),
                new("Shop_Menu_Appointments", "calendar", "appointments"),
                new("Shop_Menu_Therapists", "user-check", "therapists"),
                new("Shop_Menu_Services", "sparkles", "services"),
                new("Shop_Menu_Treatments", "clipboard-list", "treatments"),
                new("Shop_Menu_Consent", "file-check", "consent"),
                new("Shop_Menu_Doctors", "stethoscope", "doctors"),
                new("Shop_Menu_FollowUp", "calendar-heart", "followup"),
                new("Shop_Menu_Resources", "door-open", "resources"),
                new("Shop_Menu_Products", "package", "products"),
            },
            _ => new()
            {
                new("Shop_Menu_Overview", "layout-dashboard", "overview"),
                new("Shop_Menu_POS", "monitor", "pos"),
                new("Shop_Menu_Products", "package", "menu"),
                new("Shop_Menu_Inventory", "warehouse", "inventory"),
            },
        };

        // EN: Append common tail items (spa/beauty have extra staff schedule)
        // VI: Nối thêm menu items chung (spa/beauty có thêm lịch làm việc)
        if (vertical is "spa" or "beauty")
        {
            items.Add(new("Shop_Menu_Finance", "trending-up", "finance"));
            items.Add(new("Shop_Menu_Staff", "users", "staff"));
            items.Add(new("Shop_Menu_Schedule", "calendar-clock", "schedule"));
            items.Add(new("Shop_Menu_Customers", "heart", "customers"));
            items.Add(new("Shop_Menu_Promotions", "tag", "promotions"));
            items.Add(new("Shop_Menu_Reports", "bar-chart-2", "reports"));
            items.Add(new("Shop_Menu_AiChat", "bot", "ai-chat"));
            items.Add(new("Shop_Menu_Drive", "hard-drive", "drive"));
            items.Add(new("Shop_Menu_Settings", "settings", "settings"));
        }
        else
        {
            items.AddRange(CommonTail());
        }

        return items;
    }

    /// <summary>
    /// EN: Get vertical display name (delegates to ShopVerticalHelper).
    /// VI: Lấy tên hiển thị của ngành hàng (ủy quyền cho ShopVerticalHelper).
    /// </summary>
    public static string GetVerticalLabel(string? category) => ShopVerticalHelper.GetLabel(category);

    /// <summary>
    /// EN: Get vertical icon (delegates to ShopVerticalHelper).
    /// VI: Lấy icon ngành hàng (ủy quyền cho ShopVerticalHelper).
    /// </summary>
    public static string GetVerticalIcon(string? category) => ShopVerticalHelper.GetIcon(category);
}
