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

namespace Domain.Entities.Forum.Posts
{
    [Table("PostTag")]
    [Index(nameof(BoardID))]
    [Index(nameof(PostID))]
    [Index(nameof(TagID))]
    public class PostTag
    {
        [ForeignKey(nameof(BoardID))]
        public Board Board { get; set; } = null!;

        [ForeignKey(nameof(PostID))]
        public Post Post { get; set; } = null!;

        [ForeignKey(nameof(TagID))]
        public Tag Tag { get; set; } = null!;

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

        [DisplayName("게시판 ID")]
        [Comment("게시판 ID")]
        public int BoardID { get; set; }

        [DisplayName("게시글 ID")]
        [Comment("게시글 ID")]
        public int PostID { get; set; }

        [DisplayName("태그 ID")]
        [Comment("태그 ID")]
        public int TagID { get; set; }

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