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

namespace Lada.Framework.Data.Mappings.EntityMappings.Rewards
{
    public class AutoPenaltyConfigMap : IEntityMappingConfiguration<AutoPenaltyConfig>
    {
        public void Map(EntityTypeBuilder<AutoPenaltyConfig> builder)
        {
            builder.HasKey(c => c.Id);

            builder.HasMany(c => c.Levels)
                    .WithOne(l => l.Config)
                    .HasForeignKey(l => l.ConfigId)
                    .OnDelete(DeleteBehavior.Cascade);

            builder.ToTable("AutoPenaltyConfig");
        }
    }
}
