using Gremlin.GremlinData.EntityClasses;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Gremlin.GremlinData.DBClasses
{
    public class AccountConfiguration : IEntityTypeConfiguration<Account>
    {

        public void Configure(EntityTypeBuilder<Account> entity)
        {
            entity.HasKey(e => e.AccountId);
            entity.HasMany(d => d.Contacts).WithOne(p => p.Account).IsRequired(true);
            entity.HasOne(d => d.AccountType).WithMany(p => p.Accounts).IsRequired(true).OnDelete(DeleteBehavior.Restrict);
            entity.HasOne(d => d.SubMarket).WithMany(p => p.Accounts).IsRequired(true).OnDelete(DeleteBehavior.Restrict);
            entity.HasAlternateKey(e => e.SAPAccountNumber);        // =Unique
            
            entity.Property(e => e.AccountId).ValueGeneratedOnAdd();
            entity.Property(e => e.ParentAccountId);
            entity.Property(e => e.AccountName).IsRequired(true).HasMaxLength(250);
                        //.HasColumnType("VARCHAR(250)") ist überflüssig, da .HasMaxLength(250) VARCHAR(250) impliziert.
            entity.Property(e => e.Notes);
            entity.Property(e => e.Street).IsRequired(true).HasMaxLength(100);
            entity.Property(e => e.ZIP).IsRequired(true).HasColumnType("Char(5)");
            entity.Property(e => e.City).IsRequired(true).HasMaxLength(50);
            entity.Property(e => e.FloorOrBuilding).HasMaxLength(50);
            entity.Property(e => e.Longitude);
            entity.Property(e => e.Latitude);
            entity.Property(e => e.PhoneNumber).IsRequired(true).HasMaxLength(30);
            entity.Property(e => e.FaxNumber).HasMaxLength(30);
            entity.Property(e => e.Webpage).HasMaxLength(250);
            entity.Property(e => e.EMail).HasMaxLength(150);
            entity.Property(e => e.SAPAccountNumber).IsRequired(true);
            entity.Property(e => e.AccountCreatedInSAPOn).IsRequired(true);
            
            entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
            entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
            entity.Property(e => e.DataVersionComment).HasDefaultValue("");
            entity.Property(e => e.DataStatus).IsRequired(true);
                        //.HasDefaultValue("Active")  //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
            entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
                        //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
            entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").IsRequired(true).HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
        }
    }

    public class ContactConfiguration : IEntityTypeConfiguration<Contact>
    {
        public void Configure(EntityTypeBuilder<Contact> entity)
        {
            entity.HasKey(e => e.ContactId);
            entity.HasOne(p => p.Account).WithMany(d => d.Contacts).IsRequired(true);
            //entity.HasAlternateKey(e => e.SAPContactNumber);
            
            entity.Property(e => e.ContactId);
            entity.Property(e => e.SAPContactNumber).IsRequired(true);
            entity.Property(e => e.AcademicTitle);
            entity.Property(e => e.FirstName);
            entity.Property(e => e.LastName).IsRequired(true);
            entity.Property(e => e.Gender);
            //.IsRequired(true) darf nicht gesetzt werden, da sonst vom  DB-Engine NULL nicht erlaubt wird (trotz Definition als Bool? im Code. MySQL kennt kein Bool, sondern wandelt das intern in Tinyint um).
            entity.Property(e => e.OptInStatus).HasDefaultValue(null);
            entity.Property(e => e.IsReference).HasDefaultValue(false);
            entity.Property(e => e.Notes);
            entity.Property(e => e.ValidatedContact).HasDefaultValue(false);
            
            entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
            entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
            entity.Property(e => e.DataVersionComment).HasDefaultValue("");
            entity.Property(e => e.DataStatus).IsRequired(true);
            //.HasDefaultValue("Active")  //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
            entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
            //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
            entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").IsRequired(true).HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
        }
    }


    public class QuoteConfiguration : IEntityTypeConfiguration<Quote>
    {
        public void Configure(EntityTypeBuilder<Quote> entity)
        {
            entity.HasKey(e => e.QuoteId);
            entity.HasMany(d => d.LineItems).WithOne(p => p.Quote).IsRequired(false).OnDelete(DeleteBehavior.Cascade);
            
            entity.Property(e => e.QuotationNumber).HasColumnType("VARCHAR(255)").IsRequired(true).ValueGeneratedOnAdd();
            entity.Property(e => e.QuotationDate).IsRequired(true).ValueGeneratedOnAdd();
            entity.Property(e => e.ValidUntil);
            entity.Property(e => e.ValidFor).IsRequired(true);
            
            entity.Ignore("SalesRep");

            entity.Property(e => e.TotalListprice);
            entity.Property(e => e.TotalDiscount);
            entity.Property(e => e.TotalNet);
            entity.Property(e => e.VAT);
            entity.Property(e => e.TotalGross);
            entity.Property(e => e.QuoteContains3PP).HasDefaultValue(false);
            entity.Property(e => e.QuoteContainsRB).HasDefaultValue(false);
            entity.Property(e => e.QuoteTemplate);
            
            entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
            entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
            entity.Property(e => e.DataVersionComment).HasDefaultValue("");
            entity.Property(e => e.DataStatus).IsRequired(true);
            //.HasDefaultValue("Active")  //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
            entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
            //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
            entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").IsRequired(true).HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
        }
    }

    public class LineItemConfiguration : IEntityTypeConfiguration<LineItem>
    {
        public void Configure(EntityTypeBuilder<LineItem> entity)
        {
            entity.HasKey(e => e.LineItemId);
            entity.HasOne(p => p.Quote).WithMany(d => d.LineItems).HasForeignKey(fk => fk.QuoteId).IsRequired(true).OnDelete(DeleteBehavior.Cascade);
            
            entity.Property(e => e.Position).IsRequired(true);
            entity.Property(e => e.Amount).IsRequired(true);
            entity.Property(e => e.ProductNumber).IsRequired(true);
            entity.Property(e => e.OptionNumber);
            entity.Property(e => e.SapShortDescription);
            entity.Property(e => e.SapLongDescription);
            entity.Property(e => e.ProductLine);
            entity.Property(e => e.TotalDiscount).IsRequired(true).HasDefaultValue(0);
            entity.Property(e => e.SalesDiscount).IsRequired(true).HasDefaultValue(0);
            entity.Property(e => e.PromotionalDiscount).IsRequired(true).HasDefaultValue(0);
            entity.Property(e => e.ContractualDiscount).IsRequired(true).HasDefaultValue(0);
            entity.Property(e => e.DemoDiscount).IsRequired(true).HasDefaultValue(0);
            entity.Property(e => e.ListPrice).IsRequired(true);
            entity.Property(e => e.ExtendedListPrice).IsRequired(true);
            entity.Property(e => e.NetPrice).IsRequired(true);
            entity.Property(e => e.Total).IsRequired(true);
            
            entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
            entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
            entity.Property(e => e.DataVersionComment).HasDefaultValue("");
            entity.Property(e => e.DataStatus).IsRequired(true);
            //.HasDefaultValue("Active")  //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
            entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
            //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
            entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").IsRequired(true).HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
        }
    }

    public class ProductConfiguration : IEntityTypeConfiguration<Product>
    {
        public void Configure(EntityTypeBuilder<Product> entity)
        {
            entity.HasKey(e => e.ProductId);
            entity.HasOne(d => d.CustomDescription).WithMany(p => p.Products).HasForeignKey("CustomDescriptionId").IsRequired(false).OnDelete(DeleteBehavior.SetNull);  //.IsRequired() is just fyi, because it is overwritten by FK property nullability (nullable = optional relationship, non-nullable = required relationship)!
            entity.HasOne(p => p.ProductLine).WithMany(d => d.Products).HasForeignKey("ProductLineCode").IsRequired(true).OnDelete(DeleteBehavior.Restrict);

            entity.Property(e => e.CustomDescriptionId).IsRequired(false);
            
            entity.Property(e => e.ProductNumber).IsRequired(true);
            entity.Property(e => e.OptionNumber);
            entity.Property(e => e.SapShortDescription);
            entity.Property(e => e.SapLongDescription);
            entity.Property(e => e.Weight);
            entity.Property(e => e.ProductStatus);
            entity.Property(e => e.IntroductionDate);
            entity.Property(e => e.ListPrice).IsRequired(true);
            
            entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
            entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
            entity.Property(e => e.DataVersionComment).HasDefaultValue("");
            entity.Property(e => e.DataStatus).IsRequired(true);
            //.HasDefaultValue("Active")  //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
            entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
            //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
            entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").IsRequired(true).HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
        }
    }

    public class CustomDescriptionConfiguration : IEntityTypeConfiguration<CustomDescription>
    {
        public void Configure(EntityTypeBuilder<CustomDescription> entity)
        {
            entity.HasKey(e => e.CustomDescriptionId);
            entity.HasMany(p => p.Products).WithOne(d => d.CustomDescription).IsRequired(false);
            entity.HasOne(p => p.Supplier).WithMany(d => d.CustomDescriptions).IsRequired(true);
            
            entity.Property(e => e.ProductNumber).IsRequired(true);
            entity.Property(e => e.OptionNumber);
            entity.Property(e => e.Heading).IsRequired(true);
            entity.Property(e => e.DescriptionText);
            entity.Property(e => e.CoverletterText);
            entity.Property(e => e.Notes);

            entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
            entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
            entity.Property(e => e.DataVersionComment).HasDefaultValue("");
            entity.Property(e => e.DataStatus).IsRequired(true);
            //.HasDefaultValue("Active")  //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
            entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
            //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
            entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").IsRequired(true).HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
        }
    }

    public class ProductLineConfiguration : IEntityTypeConfiguration<ProductLine>
    {
        public void Configure(EntityTypeBuilder<ProductLine> entity)
        {
            entity.HasMany(p => p.Products).WithOne(d => d.ProductLine).IsRequired(true).OnDelete(DeleteBehavior.Restrict);
            
            entity.Property(e => e.ProductLineDescription).IsRequired(true);

            entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
            entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
            entity.Property(e => e.DataVersionComment).HasDefaultValue("");
            entity.Property(e => e.DataStatus).IsRequired(true);
            //.HasDefaultValue("Active")  //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
            entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
            //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
            entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").IsRequired(true).HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
        }
    }

    public class AccountTypeConfiguration : IEntityTypeConfiguration<AccountType>
    {
        public void Configure(EntityTypeBuilder<AccountType> entity)
        {
            //entity.HasKey(e => e.AccountTypeCode);
            //entity.HasMany(p => p.Accounts).WithOne(d => d.AccountType); //already defined in class Account
            entity.Property(e => e.AccountTypeCode).IsRequired(true).HasColumnType("Char(3)");
            entity.Property(e => e.AccountTypeDescription).HasColumnType("Varchar(1000)").IsRequired(true);
            
            entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
            entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
            entity.Property(e => e.DataVersionComment).HasDefaultValue("");
            entity.Property(e => e.DataStatus).IsRequired(true);
            //.HasDefaultValue("Active")  //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
            entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
            //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
            entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").IsRequired(true).HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
        }
    }

    public class SubMarketConfiguration : IEntityTypeConfiguration<SubMarket>
    {
        public void Configure(EntityTypeBuilder<SubMarket> entity)
        {
            //entity.HasKey(e => e.SubMarketCode);
            //entity.HasMany(p => p.Accounts).WithOne(d => d.SubMarket);  //already defined in class Account
            entity.Property(e => e.SubMarketCode).HasColumnType("Char(3)");
            entity.Property(e => e.SubMarketDescription).HasColumnType("Varchar(1000)").IsRequired(true);
            
            entity.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            entity.Property(e => e.DataValidFrom).HasColumnType("DATETIME").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            entity.Property(e => e.DataValidUntil).HasColumnType("DATETIME").HasDefaultValueSql("'9999-12-31 23:59:59.000000'").ValueGeneratedOnAdd();
            entity.Property(e => e.DataVersionNumber).HasDefaultValue(1).IsRequired(true);
            entity.Property(e => e.DataVersionComment).HasDefaultValue("");
            entity.Property(e => e.DataStatus).IsRequired(true);
            //.HasDefaultValue("Active")  //Default-Wert wird nicht gesetzt?!? Bug in EF Core?
            entity.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
            //.IsRowVersion() impliziert .ValueGeneratedOnAddOrUpdate() und .IsConcurrencyToken(true)
            entity.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").IsRequired(true).HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
        }
    }

    public class RegisteredUserConfiguration : IEntityTypeConfiguration<RegisteredUser>
    {
        public void Configure(EntityTypeBuilder<RegisteredUser> builder)
        {
            builder.HasKey(e => e.RegisteredUserID);

            builder.HasMany(d => d.RUSettings).WithOne(p => p.RegisteredUser).IsRequired(true);
            builder.Property(e => e.UserName).IsRequired(true);
            builder.Property(e => e.PasswordHash).IsRequired(true);

            builder.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            builder.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
            builder.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
        }
    }

    public class RUSettingsConfiguration : IEntityTypeConfiguration<RUSettings>
    {
        public void Configure(EntityTypeBuilder<RUSettings> builder)
        {
            builder.HasKey(e => e.RUSettingsID);

            builder.HasOne(d => d.RegisteredUser).WithMany(p => p.RUSettings).IsRequired(true);
            builder.Property(e => e.SettingKey).IsRequired(true);
            builder.Property(e => e.SettingValue).IsRequired(true);

            builder.Property(e => e.DataCreationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP").ValueGeneratedOnAdd();
            builder.Property(e => e.DataModificationDate).HasColumnType("TIMESTAMP").HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").ValueGeneratedOnAddOrUpdate().IsConcurrencyToken(true);
            builder.Property(e => e.DataModificationByUser).HasColumnType("TINYTEXT").HasDefaultValueSql("ON INSERT CURRENT_USER() ON UPDATE CURRENT_USER()");
        }
    }
}
