using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using MS.Entities;
using MS.Entities.Core;
using MS.Entities.Models;

namespace MS.DbContexts.Mappings
{
    public class CurrenciesMap : IEntityTypeConfiguration<Currencies>
    {
        public void Configure(EntityTypeBuilder<Currencies> builder)
        {
            builder.ToTable("Currencies");
            builder.HasIndex(e => e.Name)
        .HasName("Currencies_IX_CurrencyName")
            .IsUnique();

            builder.Property(e => e.Id).HasDefaultValueSql("uuid_generate_v4()");
        }
    }
}
