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("CommentLinkClickLog")]
    [Index(nameof(CommentID))]
    [Index(nameof(CommentLinkID))]
    [Index(nameof(MemberID))]
    [Index(nameof(CommentID), nameof(CommentLinkID))]
    [Index(nameof(CommentID), nameof(CommentLinkID), nameof(MemberID))]
    public class CommentLinkClickLog
    {
        [ForeignKey(nameof(CommentID))]
        public Comment Comment { get; set; } = null!;

        [ForeignKey(nameof(CommentLinkID))]
        public CommentLink CommentLink { 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 CommentLinkID { get; set; }

        [Comment("회원 ID")]
        public int? MemberID { 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;
    }
}