using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace bitforum.Models.Page.Faq
{
    [Table("FaqItem")]
    [Index(nameof(Order), Name = "IX_FaqItem_Order")]
    [Index(nameof(IsActive), Name = "IX_FaqItem_IsActive")]
    public class FaqItem
    {
        [ValidateNever]
        public virtual FaqCategory FaqCategory { get; set; } = null;

        [Key]
        public int ID { get; set; }

        [Required]
        [ForeignKey("FaqCategory")]
        [DisplayName("분류ID")]
        public int CategoryID { get; set; }

        [Required]
        [DisplayName("질문")]
        [DataType(DataType.Text)]
        [MaxLength(255)]
        public string Question { get; set; }

        [DisplayName("답변")]
        [DataType(DataType.Html)]
        public string? Answer { get; set; } = null;

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

        [Required]
        [DisplayName("사용 여부")]
        public bool IsActive { get; set; } = false;

        [DisplayName("조회 수")]
        public int Views { get; set; } = 0;

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

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