// <auto-generated />
using System;
using Graveyard_Backend.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace Graveyard_Backend.Migrations
{
    [DbContext(typeof(ContextModel))]
    partial class contextModelModelSnapshot : ModelSnapshot
    {
        protected override void BuildModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "7.0.4")
                .HasAnnotation("Relational:MaxIdentifierLength", 63);

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("Graveyard_Backend.Models.Burried", b =>
                {
                    b.Property<int>("BurriedId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("BurriedId"));

                    b.Property<DateTime>("BurialDate")
                        .HasColumnType("timestamp without time zone");

                    b.Property<DateOnly>("Date_of_birth")
                        .HasColumnType("date");

                    b.Property<DateOnly>("Date_of_death")
                        .HasColumnType("date");

                    b.Property<string>("Lastname")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("text");

                    b.HasKey("BurriedId");

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

            modelBuilder.Entity("Graveyard_Backend.Models.Cart", b =>
                {
                    b.Property<int>("CartId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("CartId"));

                    b.Property<int>("CustomerId")
                        .HasColumnType("integer");

                    b.Property<int>("GraveId")
                        .HasColumnType("integer");

                    b.Property<int>("ItemId")
                        .HasColumnType("integer");

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

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

                    b.HasKey("CartId");

                    b.HasIndex("CustomerId");

                    b.HasIndex("GraveId");

                    b.HasIndex("ItemId");

                    b.HasIndex("PurchaseHistoryShopHistoryId");

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

            modelBuilder.Entity("Graveyard_Backend.Models.Customer", b =>
                {
                    b.Property<int>("CustomerId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("CustomerId"));

                    b.Property<DateTime>("Date_of_creation")
                        .HasColumnType("timestamp without time zone");

                    b.Property<string>("Email")
                        .IsRequired()
                        .HasColumnType("text");

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

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("Owned_role")
                        .HasColumnType("integer");

                    b.Property<string>("Password")
                        .IsRequired()
                        .HasColumnType("text");

                    b.HasKey("CustomerId");

                    b.HasIndex("Email", "Password");

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

            modelBuilder.Entity("Graveyard_Backend.Models.Grave", b =>
                {
                    b.Property<int>("GraveId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("GraveId"));

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

                    b.Property<DateTime>("ValidUntil")
                        .HasColumnType("timestamp without time zone");

                    b.Property<int>("x")
                        .HasColumnType("integer");

                    b.Property<int>("y")
                        .HasColumnType("integer");

                    b.HasKey("GraveId");

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

            modelBuilder.Entity("Graveyard_Backend.Models.GraveBurried", b =>
                {
                    b.Property<int>("BurriedGraveId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("BurriedGraveId"));

                    b.Property<int>("BurriedId")
                        .HasColumnType("integer");

                    b.Property<int>("GraveId")
                        .HasColumnType("integer");

                    b.Property<int>("GravediggerId")
                        .HasColumnType("integer");

                    b.HasKey("BurriedGraveId");

                    b.HasIndex("BurriedId");

                    b.HasIndex("GraveId");

                    b.HasIndex("GravediggerId");

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

            modelBuilder.Entity("Graveyard_Backend.Models.Gravedigger", b =>
                {
                    b.Property<int>("GravediggerId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("GravediggerId"));

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

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

                    b.HasKey("GravediggerId");

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

            modelBuilder.Entity("Graveyard_Backend.Models.Item", b =>
                {
                    b.Property<int>("ItemId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ItemId"));

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<string>("ImageURL")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("Kind")
                        .HasColumnType("integer");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<decimal>("Price")
                        .HasColumnType("numeric");

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

                    b.HasKey("ItemId");

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

            modelBuilder.Entity("Graveyard_Backend.Models.PurchaseHistory", b =>
                {
                    b.Property<int>("ShopHistoryId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ShopHistoryId"));

                    b.Property<int>("CustomerId")
                        .HasColumnType("integer");

                    b.Property<DateOnly>("Date_of_purchase")
                        .HasColumnType("date");

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

                    b.Property<decimal>("TotalPrice")
                        .HasColumnType("numeric");

                    b.HasKey("ShopHistoryId");

                    b.HasIndex("CustomerId");

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

            modelBuilder.Entity("Graveyard_Backend.Models.Cart", b =>
                {
                    b.HasOne("Graveyard_Backend.Models.Customer", "Customer")
                        .WithMany("Carts")
                        .HasForeignKey("CustomerId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Graveyard_Backend.Models.Grave", "Grave")
                        .WithMany()
                        .HasForeignKey("GraveId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Graveyard_Backend.Models.Item", "Items")
                        .WithMany()
                        .HasForeignKey("ItemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Graveyard_Backend.Models.PurchaseHistory", null)
                        .WithMany("Cart")
                        .HasForeignKey("PurchaseHistoryShopHistoryId");

                    b.Navigation("Customer");

                    b.Navigation("Grave");

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

            modelBuilder.Entity("Graveyard_Backend.Models.GraveBurried", b =>
                {
                    b.HasOne("Graveyard_Backend.Models.Burried", "Burried")
                        .WithMany()
                        .HasForeignKey("BurriedId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Graveyard_Backend.Models.Grave", "Grave")
                        .WithMany()
                        .HasForeignKey("GraveId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Graveyard_Backend.Models.Gravedigger", "Gravedigger")
                        .WithMany()
                        .HasForeignKey("GravediggerId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Burried");

                    b.Navigation("Grave");

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

            modelBuilder.Entity("Graveyard_Backend.Models.PurchaseHistory", b =>
                {
                    b.HasOne("Graveyard_Backend.Models.Customer", "Customer")
                        .WithMany()
                        .HasForeignKey("CustomerId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("Graveyard_Backend.Models.Customer", b =>
                {
                    b.Navigation("Carts");
                });

            modelBuilder.Entity("Graveyard_Backend.Models.PurchaseHistory", b =>
                {
                    b.Navigation("Cart");
                });
#pragma warning restore 612, 618
        }
    }
}
