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()");
		}
	}
}
