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

namespace bitforum.Models.Page.Banner
{
    [Table("BannerPosition")]
    [Index(nameof(Code), Name = "IX_BannerPosition_Code", IsUnique = true)]
    [Index(nameof(IsActive), Name = "IX_BannerPosition_IsActive")]
    public class BannerPosition
    {
        public virtual ICollection<BannerItem> BannerItem { get; set; } = new List<BannerItem>();

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

        [Required]
        [DisplayName("위치 구분")]
        [DataType(DataType.Text)]
        [MaxLength(30)]
        [RegularExpression(@"^[a-zA-Z0-9]+$", ErrorMessage = "위치 구분은 영문 및 숫자로만 구성되어야 합니다.")]
        public string Code { get; set; }

        [Required]
        [DisplayName("위치 명")]
        [DataType(DataType.Text)]
        [MaxLength(255)]
        public string Subject { get; set; }

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

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

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