using Indotalent.Data.Entities; using Indotalent.Shared.Consts; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace Indotalent.Infrastructure.Database.MsSQL.Configuration; public class MedicalRecordConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.Property(e => e.AutoNumber) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.Subjective) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.Objective) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.Assessment) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.Planning) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.BloodPressure) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.Temperature) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.HeartRate) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.Weight) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.Height) .HasMaxLength(GlobalConsts.StringLengthShort); builder.Property(e => e.Description) .HasMaxLength(GlobalConsts.StringLengthMedium); builder.Property(e => e.PatientId) .HasMaxLength(GlobalConsts.StringLengthId); builder.Property(e => e.EmployeeId) .HasMaxLength(GlobalConsts.StringLengthId); builder.Property(e => e.MedicalRecordGroupId) .HasMaxLength(GlobalConsts.StringLengthId); builder.Property(e => e.MedicalRecordCategoryId) .HasMaxLength(GlobalConsts.StringLengthId); builder.HasOne(e => e.Patient) .WithMany() .HasForeignKey(e => e.PatientId) .OnDelete(DeleteBehavior.NoAction); builder.HasOne(e => e.Employee) .WithMany() .HasForeignKey(e => e.EmployeeId) .OnDelete(DeleteBehavior.NoAction); builder.HasOne(e => e.MedicalRecordGroup) .WithMany() .HasForeignKey(e => e.MedicalRecordGroupId) .OnDelete(DeleteBehavior.NoAction); builder.HasOne(e => e.MedicalRecordCategory) .WithMany() .HasForeignKey(e => e.MedicalRecordCategoryId) .OnDelete(DeleteBehavior.NoAction); builder.HasIndex(e => e.AutoNumber).IsUnique(); builder.HasIndex(e => e.RecordDate); builder.HasIndex(e => e.PatientId); builder.HasIndex(e => e.EmployeeId); } }