using Lada.Framework.Data.Domains.Premises;
using Lada.Framework.Data.Mappings;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Lada.Framework.Data.Mappings.EntityMappings.Premises
{
    public class PremiseScoringCriteriaMap : IEntityMappingConfiguration<PremiseScoringCriteria>
    {
        public void Map(EntityTypeBuilder<PremiseScoringCriteria> builder)
        {
            builder.ToTable("PremiseScoringCriteria");

            builder.HasKey(x => x.Id);

            // Properties
            builder.Property(x => x.Name).HasMaxLength(200).IsRequired();
            builder.Property(x => x.Description).HasMaxLength(500);
            builder.Property(x => x.CriteriaType).IsRequired();
            builder.Property(x => x.IsActive).HasDefaultValue(true);

            // Indexes
            builder.HasIndex(x => x.DisplayOrder)
                .HasDatabaseName("IX_PremiseScoringCriteria_DisplayOrder");
        }
    }
}
