using Microsoft.EntityFrameworkCore;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace bitforum.Models.BBS
{
    [Table("BoardGroup")]
    [Index(nameof(Code), Name = "IX_BoardGroup_Code")]
    [Index(nameof(Name), Name = "IX_BoardGroup_Name")]
    [Index(nameof(Order), Name = "IX_BoardGroup_Order")]
    [Index(nameof(Boards), Name = "IX_BoardGroup_Boards")]
    [Index(nameof(Posts), Name = "IX_BoardGroup_Posts")]
    [Index(nameof(Comments), Name = "IX_BoardGroup_Comments")]
    public class BoardGroup
    {
        public virtual ICollection<Board> Board { get; set; } = new List<Board>();

        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [DisplayName("PK")]
        [Comment("PK")]
        public int ID { get; set; }

        [Required]
        [DisplayName("게시판 분류 주소")]
        [Comment("게시판 분류 주소")]
        [DataType(DataType.Text)]
        [StringLength(70)]
        public string Code { get; set; } = null!;

        [Required]
        [DisplayName("게시판 분류 명")]
        [Comment("게시판 분류 명")]
        [DataType(DataType.Text)]
        [StringLength(70)]
        public string Name { get; set; } = null!;

        [Required]
        [DisplayName("순서")]
        [Comment("순서")]
        public short Order { get; set; } = 0;

        [DisplayName("게시판 수")]
        [Comment("게시판 수")]
        public ushort Boards { get; set; } = 0;

        [DisplayName("게시글 수")]
        [Comment("게시글 수")]
        public uint Posts { get; set; } = 0;

        [DisplayName("댓글 수")]
        [Comment("댓글 수")]
        public uint Comments { get; set; } = 0;

        [DisplayName("수정 일시")]
        [Comment("수정 일시")]
        [DataType(DataType.DateTime)]
        public DateTime? UpdatedAt { get; set; } = null;

        [DisplayName("등록 일시")]
        [Comment("등록 일시")]
        [DataType(DataType.DateTime)]
        public DateTime CreatedAt { get; set; }
    }
}
