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("EmailChangeLog")]
    [Comment("이메일 변경 내역")]
    [Index(nameof(MemberID), Name = "IX_EmailChangeLog_MemberID")]
    public class EmailChangeLog
    {
        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? BeforeEmail { get; set; }

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

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