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

namespace SportsDivision.Infrastructure.Data.Configurations;

public class RelayTeamConfiguration : IEntityTypeConfiguration<RelayTeam>
{
    public void Configure(EntityTypeBuilder<RelayTeam> builder)
    {
        builder.HasKey(r => r.RelayTeamId);
        builder.Property(r => r.Name).IsRequired().HasMaxLength(100);
        builder.HasOne(r => r.School).WithMany().HasForeignKey(r => r.SchoolId).OnDelete(DeleteBehavior.Restrict);
    }
}
