using Microsoft.AspNetCore.Html;
using Microsoft.Extensions.Logging.Console;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AppLibs.Libs
{
    public class NavItem
    {
        [JsonProperty(PropertyName = "id")]
        public string ID { set; get; }

        [JsonProperty(PropertyName = "name")]
        public string Name { set; get; }

        [JsonProperty(PropertyName = "group")]
        public bool IsGroup { set; get; }

        [JsonProperty(PropertyName = "icon")]
        public string Icon { set; get; }

        [JsonProperty(PropertyName = "url")]
        public string Url { set; get; }

        [JsonProperty(PropertyName = "flexpage")]
        public bool? IsFlexPage { set; get; }

        [JsonProperty(PropertyName = "sub-item")]
        public List<NavItem> SubItem { set; get; }

        public NavItem()
        {
            Icon = "";
            ID = "";
            Name = "";
            IsGroup = false;
            IsFlexPage = false;
            Url = "";
            SubItem = new List<NavItem>();
        }

        public IHtmlContent ToFlexPageAttribute()
        {
            Console.WriteLine(IsFlexPage.ToString());
            if (IsFlexPage.HasValue && IsFlexPage.Value)
            {
                
                return new HtmlString("IsFlexPage");
            }
            else
            {
                return new HtmlString("");
            }
        }

    }
}
