using Domain.Entities.Forum.Comments;
using Domain.Entities.Members;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Domain.Entities.Forum.Logs
{
    [Table("CommentUpdateLog")]
    [Index(nameof(CommentID))]
    [Index(nameof(MemberID))]
    [Index(nameof(ContentDiff))]
    [Index(nameof(CommentID), nameof(ID))]
    [Index(nameof(CommentID), nameof(MemberID))]
    [Index(nameof(CommentID), nameof(MemberID), nameof(ID))]
    public class CommentUpdateLog
    {
        [ForeignKey(nameof(CommentID))]
        public Comment Comment { get; set; } = null!;

        [ForeignKey(nameof(MemberID))]
        public Member Member { get; set; } = null!;

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

        [Comment("댓글 ID")]
        public int CommentID { get; set; }

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

        [Comment("변경 내용")]
        [StringLength(4000)]
        public string? ContentDiff { get; set; }

        [Comment("비고")]
        [StringLength(200)]
        public string? Note { get; set; }

        [Comment("IP Address")]
        [MaxLength(50)]
        public string? IpAddress { get; set; }

        [Comment("User-Agent")]
        [MaxLength(255)]
        public string? UserAgent { get; set; }

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