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

namespace bitforum.Models.Page
{
    [Table("Popup")]
    [Index(nameof(Order), Name = "IX_Popup_Order")]
    [Index(nameof(IsActive), Name = "IX_Popup_IsActive")]
    public class Popup
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [DisplayName("PK")]
        [Comment("PK")]
        public int ID { get; set; }

        [Required]
        [DisplayName("제목")]
        [Comment("제목")]
        [DataType(DataType.Text)]
        [StringLength(255)]
        public string Subject { get; set; } = null!;

        [DisplayName("내용")]
        [Comment("내용")]
        [DataType(DataType.Html)]
        public string? Content { get; set; } = null;

        [DisplayName("주소")]
        [Comment("주소")]
        [DataType(DataType.Url)]
        [StringLength(255)]
        public string? Link { get; set; } = null;

        [DisplayName("사용 기간 - 시작")]
        [Comment("사용 기간 - 시작")]
        [DataType(DataType.DateTime)]
        public DateTime? StartAt { get; set; } = null;

        [DisplayName("사용 기간 - 종료")]
        [Comment("사용 기간 - 종료")]
        [DataType(DataType.DateTime)]
        public DateTime? EndAt { get; set; } = null;

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

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

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

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

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