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

namespace JSMR.Infrastructure.Data.Configuration;

public sealed class CreatorConfiguration : IEntityTypeConfiguration<Creator>
{
    public void Configure(EntityTypeBuilder<Creator> builder)
    {
        builder.ToTable("Creators");
        builder.HasKey(x => x.CreatorId);

        builder.Property(x => x.Name).IsRequired().HasMaxLength(128);

        builder.HasIndex(x => x.Name);
        builder.HasIndex(x => x.Favorite);
        builder.HasIndex(x => x.Blacklisted);
    }
}