using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using SportsDivision.Domain.Entities;

namespace SportsDivision.Infrastructure.Data.Configurations;

public class HighJumpHeightConfiguration : IEntityTypeConfiguration<HighJumpHeight>
{
    public void Configure(EntityTypeBuilder<HighJumpHeight> builder)
    {
        builder.HasKey(h => h.HighJumpHeightId);
        builder.Property(h => h.Height).HasPrecision(5, 2);
        builder.HasOne(h => h.TournamentEventLevel).WithMany(t => t.HighJumpHeights).HasForeignKey(h => h.TournamentEventLevelId).OnDelete(DeleteBehavior.Cascade);
    }
}
