// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using DiunaBI.Domain.Entities;
using DiunaBI.Infrastructure.Data;

#nullable disable

namespace DiunaBI.Infrastructure.Migrations
{
    [DbContext(typeof(AppDbContext))]
    [Migration("20250725133501_DataInbox.LayerId")]
    partial class DataInboxLayerId
    {
        /// <inheritdoc />
        protected void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "8.0.0")
                .HasAnnotation("Relational:MaxIdentifierLength", 128);

            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);

            modelBuilder.Entity("DiunaBI.Core.Models.DataInbox", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("datetime2");

                    b.Property<string>("Data")
                        .IsRequired()
                        .HasMaxLength(2147483647)
                        .HasColumnType("nvarchar(max)");

                    b.Property<Guid?>("LayerId")
                        .HasColumnType("uniqueidentifier");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

                    b.Property<string>("Source")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

                    b.HasKey("Id");

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

            modelBuilder.Entity("DiunaBI.Core.Models.Layer", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("datetime2");

                    b.Property<Guid>("CreatedById")
                        .HasColumnType("uniqueidentifier");

                    b.Property<bool>("IsCancelled")
                        .HasColumnType("bit");

                    b.Property<bool>("IsDeleted")
                        .HasColumnType("bit");

                    b.Property<DateTime>("ModifiedAt")
                        .HasColumnType("datetime2");

                    b.Property<Guid>("ModifiedById")
                        .HasColumnType("uniqueidentifier");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

                    b.Property<int>("Number")
                        .HasColumnType("int");

                    b.Property<Guid?>("ParentId")
                        .HasColumnType("uniqueidentifier");

                    b.Property<int>("Type")
                        .HasColumnType("int");

                    b.HasKey("Id");

                    b.HasIndex("CreatedById");

                    b.HasIndex("ModifiedById");

                    b.HasIndex("ParentId");

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

            modelBuilder.Entity("DiunaBI.Core.Models.ProcessSource", b =>
                {
                    b.Property<Guid>("LayerId")
                        .HasColumnType("uniqueidentifier");

                    b.Property<Guid>("SourceId")
                        .HasColumnType("uniqueidentifier");

                    b.HasKey("LayerId", "SourceId");

                    b.HasIndex("SourceId");

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

            modelBuilder.Entity("DiunaBI.Core.Models.QueueJob", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier");

                    b.Property<DateTime?>("CompletedAt")
                        .HasColumnType("datetime2");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("datetime2");

                    b.Property<DateTime>("CreatedAtUtc")
                        .HasColumnType("datetime2");

                    b.Property<Guid>("CreatedById")
                        .HasColumnType("uniqueidentifier");

                    b.Property<int>("JobType")
                        .HasColumnType("int");

                    b.Property<DateTime?>("LastAttemptAt")
                        .HasColumnType("datetime2");

                    b.Property<string>("LastError")
                        .HasMaxLength(1000)
                        .HasColumnType("nvarchar(1000)");

                    b.Property<Guid>("LayerId")
                        .HasColumnType("uniqueidentifier");

                    b.Property<string>("LayerName")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("nvarchar(200)");

                    b.Property<int>("MaxRetries")
                        .HasColumnType("int");

                    b.Property<DateTime>("ModifiedAtUtc")
                        .HasColumnType("datetime2");

                    b.Property<Guid>("ModifiedById")
                        .HasColumnType("uniqueidentifier");

                    b.Property<string>("PluginName")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("nvarchar(100)");

                    b.Property<int>("Priority")
                        .HasColumnType("int");

                    b.Property<int>("RetryCount")
                        .HasColumnType("int");

                    b.Property<int>("Status")
                        .HasColumnType("int");

                    b.HasKey("Id");

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

            modelBuilder.Entity("DiunaBI.Core.Models.Record", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier");

                    b.Property<string>("Code")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("datetime2");

                    b.Property<Guid>("CreatedById")
                        .HasColumnType("uniqueidentifier");

                    b.Property<string>("Desc1")
                        .HasMaxLength(10000)
                        .HasColumnType("nvarchar(max)");

                    b.Property<bool>("IsDeleted")
                        .HasColumnType("bit");

                    b.Property<Guid>("LayerId")
                        .HasColumnType("uniqueidentifier");

                    b.Property<DateTime>("ModifiedAt")
                        .HasColumnType("datetime2");

                    b.Property<Guid>("ModifiedById")
                        .HasColumnType("uniqueidentifier");

                    b.Property<double?>("Value1")
                        .HasColumnType("float");

                    b.Property<double?>("Value10")
                        .HasColumnType("float");

                    b.Property<double?>("Value11")
                        .HasColumnType("float");

                    b.Property<double?>("Value12")
                        .HasColumnType("float");

                    b.Property<double?>("Value13")
                        .HasColumnType("float");

                    b.Property<double?>("Value14")
                        .HasColumnType("float");

                    b.Property<double?>("Value15")
                        .HasColumnType("float");

                    b.Property<double?>("Value16")
                        .HasColumnType("float");

                    b.Property<double?>("Value17")
                        .HasColumnType("float");

                    b.Property<double?>("Value18")
                        .HasColumnType("float");

                    b.Property<double?>("Value19")
                        .HasColumnType("float");

                    b.Property<double?>("Value2")
                        .HasColumnType("float");

                    b.Property<double?>("Value20")
                        .HasColumnType("float");

                    b.Property<double?>("Value21")
                        .HasColumnType("float");

                    b.Property<double?>("Value22")
                        .HasColumnType("float");

                    b.Property<double?>("Value23")
                        .HasColumnType("float");

                    b.Property<double?>("Value24")
                        .HasColumnType("float");

                    b.Property<double?>("Value25")
                        .HasColumnType("float");

                    b.Property<double?>("Value26")
                        .HasColumnType("float");

                    b.Property<double?>("Value27")
                        .HasColumnType("float");

                    b.Property<double?>("Value28")
                        .HasColumnType("float");

                    b.Property<double?>("Value29")
                        .HasColumnType("float");

                    b.Property<double?>("Value3")
                        .HasColumnType("float");

                    b.Property<double?>("Value30")
                        .HasColumnType("float");

                    b.Property<double?>("Value31")
                        .HasColumnType("float");

                    b.Property<double?>("Value32")
                        .HasColumnType("float");

                    b.Property<double?>("Value4")
                        .HasColumnType("float");

                    b.Property<double?>("Value5")
                        .HasColumnType("float");

                    b.Property<double?>("Value6")
                        .HasColumnType("float");

                    b.Property<double?>("Value7")
                        .HasColumnType("float");

                    b.Property<double?>("Value8")
                        .HasColumnType("float");

                    b.Property<double?>("Value9")
                        .HasColumnType("float");

                    b.HasKey("Id");

                    b.HasIndex("CreatedById");

                    b.HasIndex("LayerId");

                    b.HasIndex("ModifiedById");

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

            modelBuilder.Entity("DiunaBI.Core.Models.User", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uniqueidentifier");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("datetime2");

                    b.Property<string>("Email")
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

                    b.Property<string>("UserName")
                        .HasMaxLength(50)
                        .HasColumnType("nvarchar(50)");

                    b.HasKey("Id");

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

            modelBuilder.Entity("DiunaBI.Core.Models.Layer", b =>
                {
                    b.HasOne("DiunaBI.Core.Models.User", "CreatedBy")
                        .WithMany()
                        .HasForeignKey("CreatedById")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("DiunaBI.Core.Models.User", "ModifiedBy")
                        .WithMany()
                        .HasForeignKey("ModifiedById")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("DiunaBI.Core.Models.Layer", "Parent")
                        .WithMany()
                        .HasForeignKey("ParentId");

                    b.Navigation("CreatedBy");

                    b.Navigation("ModifiedBy");

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

            modelBuilder.Entity("DiunaBI.Core.Models.ProcessSource", b =>
                {
                    b.HasOne("DiunaBI.Core.Models.Layer", "Source")
                        .WithMany()
                        .HasForeignKey("SourceId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("DiunaBI.Core.Models.Record", b =>
                {
                    b.HasOne("DiunaBI.Core.Models.User", "CreatedBy")
                        .WithMany()
                        .HasForeignKey("CreatedById")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("DiunaBI.Core.Models.Layer", null)
                        .WithMany("Records")
                        .HasForeignKey("LayerId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("DiunaBI.Core.Models.User", "ModifiedBy")
                        .WithMany()
                        .HasForeignKey("ModifiedById")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("CreatedBy");

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

            modelBuilder.Entity("DiunaBI.Core.Models.Layer", b =>
                {
                    b.Navigation("Records");
                });
#pragma warning restore 612, 618
        }
    }
}
