using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using bitforum.Models.Account;

namespace bitforum.Models.Log
{
    /// <summary>
    /// 사용자 별명 변경 내역
    /// </summary>
    [Table("NameChangeLog")]
    [Comment("별명 변경 내역")]
    [Index(nameof(MemberID), Name = "IX_NameChangeLog_MemberID")]
    public class NameChangeLog
    {
        public virtual Member Member { get; set; } = null!;

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

        [ForeignKey("MemberID")]
        [DisplayName("회원 ID")]
        [Comment("회원 ID")]
        public int MemberID { get; set; }

        [DisplayName("이전 별명")]
        [Comment("이전 별명")]
        [MaxLength(40)]
        public required string? BeforeName { get; set; } = null;

        [DisplayName("바꾼 별명")]
        [Comment("바꾼 별명")]
        [MaxLength(40)]
        public required string AfterName { get; set; }

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