using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using TelerikAspNetCoreApp69.Models;

namespace TelerikAspNetCoreApp69.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }

        public JsonResult GetNavMenus()
        {
            List<SampleModel> data = new List<SampleModel>()
            {
                new SampleModel()
                {
                    ItemID = 1,
                    Label = "Root1",
                    Action = "https://www.wikipedia.org",
                    hasChildren = new List<SubItem>()
                    {
                        new SubItem() { SubItemID = 4, Label = "Item 1.1",  Action = "https://www.wikipedia.org", hasChildren = null },
                        new SubItem() { SubItemID = 5, Label = "Item 1.2",  Action = "https://www.wikipedia.org", hasChildren = null },
                        new SubItem() { SubItemID = 6, Label = "Item 1.3",  Action = "https://www.wikipedia.org", hasChildren = null }
                    }
                },
                 new SampleModel()
                {
                    ItemID = 2,
                    Label = "Root2",
                    Action = "https://www.wikipedia.org",
                    hasChildren = new List<SubItem>()
                    {
                        new SubItem() { SubItemID = 7, Label = "Item 2.1",  Action = "https://www.wikipedia.org", hasChildren = null },
                        new SubItem() { SubItemID = 8, Label = "Item 2.2",  Action = "https://www.wikipedia.org", hasChildren = null },
                        new SubItem() { SubItemID = 9, Label = "Item 2.3",  Action = "https://www.wikipedia.org", hasChildren = null }
                    }
                },
                 new SampleModel()
                {
                    ItemID = 3,
                    Label = "Root3",
                    Action = "https://www.wikipedia.org",
                    hasChildren = null
                }
            };

            return Json(data);
        }
    }
}
