// <auto-generated />
using System;
using CutList.Web.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

#nullable disable

namespace CutList.Web.Migrations
{
    [DbContext(typeof(ApplicationDbContext))]
    [Migration("20260204214947_RenameProjectToJob")]
    partial class RenameProjectToJob
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "8.0.11")
                .HasAnnotation("Relational:MaxIdentifierLength", 128);

            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);

            modelBuilder.Entity("CutList.Web.Data.Entities.CuttingTool", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

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

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

                    b.Property<decimal>("KerfInches")
                        .HasPrecision(6, 4)
                        .HasColumnType("decimal(6,4)");

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

                    b.HasKey("Id");

                    b.ToTable("CuttingTools");

                    b.HasData(
                        new
                        {
                            Id = 1,
                            IsActive = true,
                            IsDefault = true,
                            KerfInches = 0.0625m,
                            Name = "Bandsaw"
                        },
                        new
                        {
                            Id = 2,
                            IsActive = true,
                            IsDefault = false,
                            KerfInches = 0.125m,
                            Name = "Chop Saw"
                        },
                        new
                        {
                            Id = 3,
                            IsActive = true,
                            IsDefault = false,
                            KerfInches = 0.0625m,
                            Name = "Cold Cut Saw"
                        },
                        new
                        {
                            Id = 4,
                            IsActive = true,
                            IsDefault = false,
                            KerfInches = 0.0625m,
                            Name = "Hacksaw"
                        });
                });

            modelBuilder.Entity("CutList.Web.Data.Entities.Job", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

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

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

                    b.Property<int?>("CuttingToolId")
                        .HasColumnType("int");

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

                    b.Property<string>("Notes")
                        .HasColumnType("nvarchar(max)");

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

                    b.HasKey("Id");

                    b.HasIndex("CuttingToolId");

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

            modelBuilder.Entity("CutList.Web.Data.Entities.JobPart", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

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

                    b.Property<decimal>("LengthInches")
                        .HasPrecision(10, 4)
                        .HasColumnType("decimal(10,4)");

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("JobId");

                    b.HasIndex("MaterialId");

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

            modelBuilder.Entity("CutList.Web.Data.Entities.Material", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

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

                    b.Property<string>("Description")
                        .HasMaxLength(255)
                        .HasColumnType("nvarchar(255)");

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

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

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

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("CutList.Web.Data.Entities.MaterialStockLength", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

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

                    b.Property<decimal>("LengthInches")
                        .HasPrecision(10, 4)
                        .HasColumnType("decimal(10,4)");

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

                    b.Property<string>("Notes")
                        .HasMaxLength(255)
                        .HasColumnType("nvarchar(255)");

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

                    b.HasKey("Id");

                    b.HasIndex("MaterialId", "LengthInches")
                        .IsUnique();

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

            modelBuilder.Entity("CutList.Web.Data.Entities.StockItem", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

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

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

                    b.Property<decimal>("LengthInches")
                        .HasPrecision(10, 4)
                        .HasColumnType("decimal(10,4)");

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("MaterialId", "LengthInches")
                        .IsUnique();

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

            modelBuilder.Entity("CutList.Web.Data.Entities.Supplier", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

                    b.Property<string>("ContactInfo")
                        .HasMaxLength(500)
                        .HasColumnType("nvarchar(500)");

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

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

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

                    b.Property<string>("Notes")
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("Id");

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

            modelBuilder.Entity("CutList.Web.Data.Entities.SupplierOffering", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));

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

                    b.Property<string>("Notes")
                        .HasMaxLength(255)
                        .HasColumnType("nvarchar(255)");

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

                    b.Property<decimal?>("Price")
                        .HasPrecision(10, 2)
                        .HasColumnType("decimal(10,2)");

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

                    b.Property<string>("SupplierDescription")
                        .HasMaxLength(255)
                        .HasColumnType("nvarchar(255)");

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

                    b.HasKey("Id");

                    b.HasIndex("StockItemId");

                    b.HasIndex("SupplierId", "StockItemId")
                        .IsUnique();

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

            modelBuilder.Entity("CutList.Web.Data.Entities.Job", b =>
                {
                    b.HasOne("CutList.Web.Data.Entities.CuttingTool", "CuttingTool")
                        .WithMany("Jobs")
                        .HasForeignKey("CuttingToolId")
                        .OnDelete(DeleteBehavior.SetNull);

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

            modelBuilder.Entity("CutList.Web.Data.Entities.JobPart", b =>
                {
                    b.HasOne("CutList.Web.Data.Entities.Job", "Job")
                        .WithMany("Parts")
                        .HasForeignKey("JobId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("CutList.Web.Data.Entities.Material", "Material")
                        .WithMany("JobParts")
                        .HasForeignKey("MaterialId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Job");

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

            modelBuilder.Entity("CutList.Web.Data.Entities.MaterialStockLength", b =>
                {
                    b.HasOne("CutList.Web.Data.Entities.Material", "Material")
                        .WithMany("StockLengths")
                        .HasForeignKey("MaterialId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("CutList.Web.Data.Entities.StockItem", b =>
                {
                    b.HasOne("CutList.Web.Data.Entities.Material", "Material")
                        .WithMany("StockItems")
                        .HasForeignKey("MaterialId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("CutList.Web.Data.Entities.SupplierOffering", b =>
                {
                    b.HasOne("CutList.Web.Data.Entities.StockItem", "StockItem")
                        .WithMany("SupplierOfferings")
                        .HasForeignKey("StockItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("CutList.Web.Data.Entities.Supplier", "Supplier")
                        .WithMany("Offerings")
                        .HasForeignKey("SupplierId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("StockItem");

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

            modelBuilder.Entity("CutList.Web.Data.Entities.CuttingTool", b =>
                {
                    b.Navigation("Jobs");
                });

            modelBuilder.Entity("CutList.Web.Data.Entities.Job", b =>
                {
                    b.Navigation("Parts");
                });

            modelBuilder.Entity("CutList.Web.Data.Entities.Material", b =>
                {
                    b.Navigation("JobParts");

                    b.Navigation("StockItems");

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

            modelBuilder.Entity("CutList.Web.Data.Entities.StockItem", b =>
                {
                    b.Navigation("SupplierOfferings");
                });

            modelBuilder.Entity("CutList.Web.Data.Entities.Supplier", b =>
                {
                    b.Navigation("Offerings");
                });
#pragma warning restore 612, 618
        }
    }
}
