using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace labdb.Models;

public record CountryId : EntityIdBase<CountryId>;

public class Country : EntityBase<CountryId>
{
    public string Name { get; set; } = null!;
}

public class CountryConfiguration : EntityBaseConfiguration<Country, CountryId>
{
    public override void Configure(EntityTypeBuilder<Country> builder)
    {
        base.Configure(builder);

        builder.HasIndex(x => x.Name,"name").IsUnique();
        builder.HasIndex(x => x.Name, "name_trgm").HasMethod("gin").HasOperators("gin_trgm_ops");
    }
}