using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace FMSAdmin.Entities {
    public enum SitemapType {
        본사 = 0,
        현장,
        모바일
    }

    public class Sitemap {
        public Sitemap() {
            Childs = new List<Sitemap>();
            SitemapAuths = new List<SitemapAuth>();
            MobileShortcuts = new List<MobileShortcut>();
        }
        [DisplayName("ID"), Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int SitemapId { get; set; }
        [DisplayName("메뉴종류")]
        public SitemapType Type { get; set; }
        [DisplayName("메뉴명"), Required]
        public string Name { get; set; }
        [DisplayName("부모"), ForeignKey("ParentId")]
        public virtual Sitemap Parent { get; set; }
        [DisplayName("경로")]
        public string Path { get; set; }
        [DisplayName("아이콘")]
        public string Icon { get; set; }
        [DisplayName("기능1")]
        public string Action1 { get; set; }
        [DisplayName("기능2")]
        public string Action2 { get; set; }
        [DisplayName("기능3")]
        public string Action3 { get; set; }
        [DisplayName("기능4")]
        public string Action4 { get; set; }
        [DisplayName("기능5")]
        public string Action5 { get; set; }
        [DisplayName("뎁스")]
        public int Depth { get; set; }
        [DisplayName("포지션")]
        public int Position { get; set; }
        [DisplayName("숨김")]
        public bool Hidden { get; set; }
        [DisplayName("메모")]
        public string Memo { get; set; }
        [DisplayName("등록일")]
        public DateTime Created { get; set; }
        [DisplayName("수정일")]
        public DateTime Updated { get; set; }

        public int? ParentId { get; set; }

        [InverseProperty(nameof(Sitemap.Parent))]
        public virtual ICollection<Sitemap> Childs { get; set; }
        [InverseProperty(nameof(SitemapAuth.Sitemap))]
        public virtual ICollection<SitemapAuth> SitemapAuths { get; set; }
        [InverseProperty(nameof(MobileShortcut.Sitemap))]
        public virtual ICollection<MobileShortcut> MobileShortcuts { get; set; }
    }
}
