namespace Biskilog_Accounting.Client.Models
{
    /// 
    /// Structure of the sidebar navigation menu items
    /// 
    public class NavItem
    {
        /// 
        /// The unique id of the menu item
        /// 
        public double Id { get; set; }
        /// 
        /// The title of the menu item to display
        /// 
        public string Title { get; set; } = string.Empty;
        /// 
        /// The description of the menu item or description of the content of the page
        /// 
        public string Description { get; set; } = string.Empty;
        /// 
        /// The link to open the specified page tied to the menu item
        /// 
        public string Link { get; set; } = string.Empty;
        /// 
        /// The icon of the menu item
        /// 
        public string Icon { get; set; } = string.Empty;
        /// 
        /// Children or sub menu item
        /// 
        public List Children { get; set; } = new List();
    }
    /// 
    /// Contains the list of menu Items
    /// 
    public static class Menu
    {
        public static IEnumerable MenuList()
        {
            var menuItems = new List{
                new NavItem()
                {
                    Id = 1,
                    Description = "Analytics page",
                    Icon = "bx-home-circle",
                    Link = "",
                    Title = "Dashboard"
                },
                 new NavItem()
                {
                    Id = 2,
                    Description = "Transactions",
                    Title = "Transactions",
                    Icon = "bxs-cart",
                    Link = "/transactions/sales",
                    //Children = new List
                    //{
                    //    new NavItem()
                    //    {
                    //        Id = 2.1,
                    //        Title = "Sales",
                    //        Link = "/transactions/sales",
                    //    },
                    //    new NavItem()
                    //    {
                    //        Id = 2.2,
                    //        Title = "Statistics",
                    //    },
                    //},
                },
                  new NavItem()
                    {
                    Id = 3,
                    Description = "Products",
                    Icon = "bx-box",
                    Title = "Products",
                    Children = new List
                        {
                            new NavItem
                            {
                                Id = 3.1,
                                Description = "Brands",
                                Title = "Brands",
                                Link = "/products/brands",
                            },
                            new NavItem
                            {
                                Id = 3.2,
                                Description = "Category",
                                Title = "Category",
                                Link = "/products/categories",
                            },
                            new NavItem
                            {
                                Id = 3.3,
                                Description = "Inventory",
                                Title = "Inventory",
                                Link = "/products/inventory",
                            },
                            //new NavItem
                            //{
                            //    Id = 3.4,
                            //    Description = "Inventory",
                            //    Title = "Bulk Price Changes",
                            //    Link = "",
                            //},
                            //new NavItem
                            //{
                            //    Id = 3.5,
                            //    Description = "Inventory",
                            //    Title = "Products Statistics",
                            //    Link = "",
                            //}
                        }
                },
                new NavItem()
                    {
                        Id = 4,
                        Description = "Customers",
                        Icon = "bxs-group",
                        Link = "customers",
                        Title = "Customers"
                    },
                new NavItem()
                    {
                        Id = 5,
                        Description = "Users",
                        Icon = "bxs-user-account",
                        Link = "users",
                        Title = "Users"
                    },
               //new NavItem()
               //     {
               //         Id = 6,
               //         Description = "Warehouse Management",
               //         Icon = "bxs-factory",
               //         Title = "Warehouse Management",
               //         Children = new List {
               //             new NavItem(){
               //                     Id = 6.1,
               //                     Description = "Item Inventory for the warehouse",
               //                     Title = "Inventory",
               //                     Link = "",
               //             },
               //         },
               //     },
            };
            var uniqueIds = new HashSet();
            //Validates list to check if there are no duplicate Ids
            foreach (var menuItem in menuItems)
            {
                if (!uniqueIds.Add(menuItem.Id))
                {
                    throw new Exception($"Duplicate Id found: {menuItem.Id}");
                }
            }
            return menuItems;
        }
    }
}