// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using SimpleLIS;

#nullable disable

namespace SimpleLIS.Migrations
{
    [DbContext(typeof(HL7DbContext))]
    partial class HL7DbContextModelSnapshot : ModelSnapshot
    {
        protected override void BuildModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder.HasAnnotation("ProductVersion", "8.0.11");

            modelBuilder.Entity("SimpleLIS.Models.Message", b =>
                {
                    b.Property<int>("MessageId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<string>("ControlId")
                        .IsRequired()
                        .HasColumnType("TEXT");

                    b.Property<string>("MessageType")
                        .IsRequired()
                        .HasColumnType("TEXT");

                    b.Property<int>("PatientId")
                        .HasColumnType("INTEGER");

                    b.Property<string>("ReceivingApp")
                        .HasColumnType("TEXT");

                    b.Property<string>("ReceivingFacility")
                        .HasColumnType("TEXT");

                    b.Property<string>("SendingApp")
                        .HasColumnType("TEXT");

                    b.Property<string>("SendingFacility")
                        .HasColumnType("TEXT");

                    b.Property<DateTime>("Timestamp")
                        .HasColumnType("TEXT");

                    b.Property<string>("Version")
                        .HasColumnType("TEXT");

                    b.HasKey("MessageId");

                    b.HasIndex("PatientId");

                    b.ToTable("Messages");
                });

            modelBuilder.Entity("SimpleLIS.Models.Observation", b =>
                {
                    b.Property<int>("ObservationId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<string>("AbnormalFlag")
                        .HasColumnType("TEXT");

                    b.Property<int>("MessageId")
                        .HasColumnType("INTEGER");

                    b.Property<string>("ObservationCode")
                        .IsRequired()
                        .HasColumnType("TEXT");

                    b.Property<string>("ObservationValue")
                        .IsRequired()
                        .HasColumnType("TEXT");

                    b.Property<string>("ResultStatus")
                        .IsRequired()
                        .HasColumnType("TEXT");

                    b.Property<string>("Units")
                        .HasColumnType("TEXT");

                    b.HasKey("ObservationId");

                    b.HasIndex("MessageId");

                    b.ToTable("Observations");
                });

            modelBuilder.Entity("SimpleLIS.Models.Patient", b =>
                {
                    b.Property<int>("PatientId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("INTEGER");

                    b.Property<DateTime>("DateOfBirth")
                        .HasColumnType("TEXT");

                    b.Property<string>("FirstName")
                        .HasColumnType("TEXT");

                    b.Property<string>("Gender")
                        .HasColumnType("TEXT");

                    b.Property<string>("HL7PatientId")
                        .HasColumnType("TEXT");

                    b.Property<string>("LastName")
                        .HasColumnType("TEXT");

                    b.HasKey("PatientId");

                    b.ToTable("Patients");
                });

            modelBuilder.Entity("SimpleLIS.Models.Message", b =>
                {
                    b.HasOne("SimpleLIS.Models.Patient", "Patient")
                        .WithMany("Messages")
                        .HasForeignKey("PatientId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Patient");
                });

            modelBuilder.Entity("SimpleLIS.Models.Observation", b =>
                {
                    b.HasOne("SimpleLIS.Models.Message", "Message")
                        .WithMany("Observations")
                        .HasForeignKey("MessageId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Message");
                });

            modelBuilder.Entity("SimpleLIS.Models.Message", b =>
                {
                    b.Navigation("Observations");
                });

            modelBuilder.Entity("SimpleLIS.Models.Patient", b =>
                {
                    b.Navigation("Messages");
                });
#pragma warning restore 612, 618
        }
    }
}
