using Jellyfin.Data.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Jellyfin.Server.Implementations.ModelConfiguration
{
    /// 
    /// FluentAPI configuration for the DisplayPreferencesConfiguration entity.
    /// 
    public class DisplayPreferencesConfiguration : IEntityTypeConfiguration
    {
        /// 
        public void Configure(EntityTypeBuilder builder)
        {
            builder
                .HasMany(d => d.HomeSections)
                .WithOne()
                .OnDelete(DeleteBehavior.Cascade);
            builder
                .HasIndex(entity => new { entity.UserId, entity.ItemId, entity.Client })
                .IsUnique();
        }
    }
}