using Indotalent.Data.Entities; using Indotalent.Shared.Consts; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Indotalent.Infrastructure.Database.MsSQL.Configuration; public class LeadContactConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.Property(e => e.LeadId) .HasMaxLength(GlobalConsts.StringLengthId); builder.Property(e => e.AutoNumber) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.FullName) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.Description) .HasMaxLength(GlobalConsts.StringLengthMedium); builder.Property(e => e.AddressStreet) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.AddressCity) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.AddressState) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.AddressZipCode) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.AddressCountry) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.PhoneNumber) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.FaxNumber) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.MobileNumber) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.Email) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.Website) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.WhatsApp) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.LinkedIn) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.Facebook) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.Twitter) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.Instagram) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.AvatarName) .HasMaxLength(GlobalConsts.StringLengthShort); builder.HasOne(e => e.Lead) .WithMany(e => e.LeadContacts) .HasForeignKey(e => e.LeadId) .OnDelete(DeleteBehavior.NoAction); builder.HasIndex(e => new { e.TenantId, e.AutoNumber }).IsUnique(); builder.HasIndex(e => e.FullName); builder.HasIndex(e => e.LeadId); } }