using GreenTree.Strohrmann.ERP.Core.Domain.Business;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Text;

namespace GreenTree.Strohrmann.ERP.Domain.Model.Business
{
    public class TaxMapping : IEntityTypeConfiguration<Tax>
    {
        public void Configure(EntityTypeBuilder<Tax> builder)
        {
            builder.ToTable("Taxes");

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

            builder.Property(u => u.Id)
                .ValueGeneratedOnAdd();

            builder.Property(u => u.Name)
                .IsRequired();

            builder.Property(u => u.ShortName)
                .IsRequired();

            builder.Property(u => u.Value)
                .IsRequired();

            builder.HasData(
                new Tax(1, "Deutschland Umsatzsteuer", "Umst. (19%)", 0.19m),
                new Tax(2, "Deutschland Umsatzsteuer 2020", "Umst. (16%) 2020", 0.16m));
        }
    }
}
