using Lada.Framework.Data.Domains.Cms;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Lada.Framework.Data.Mappings.EntityMappings.Hr
{
    internal class JobPostTagMap : IEntityMappingConfiguration<JobPostTag>
    {
        public void Map(EntityTypeBuilder<JobPostTag> builder)
        {
            builder.HasKey(pc => new { pc.JobPostId, pc.TagId });
            builder.HasOne(pc => pc.JobPost).WithMany(p => p.JobPostTags).HasForeignKey(pc => pc.JobPostId);
            builder.HasOne(pc => pc.Tag).WithMany(p => p.JobPostTags).HasForeignKey(pc => pc.TagId);
            builder.ToTable("JobPostTag");
        }
    }
}
