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

#nullable disable

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

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("Attachedproduct", b =>
                {
                    b.Property<int>("Mainproductid")
                        .HasColumnType("integer")
                        .HasColumnName("mainproductid");

                    b.Property<int>("Attachedproductid")
                        .HasColumnType("integer")
                        .HasColumnName("attachedproductid");

                    b.HasKey("Mainproductid", "Attachedproductid")
                        .HasName("attachedproduct_pkey");

                    b.HasIndex("Attachedproductid");

                    b.ToTable("attachedproduct", "task16-09");
                });

            modelBuilder.Entity("Demo2.Models.Client", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

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

                    b.Property<DateOnly?>("Birthday")
                        .HasColumnType("date")
                        .HasColumnName("birthday");

                    b.Property<string>("Email")
                        .HasMaxLength(255)
                        .HasColumnType("character varying(255)")
                        .HasColumnName("email");

                    b.Property<string>("Firstname")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)")
                        .HasColumnName("firstname");

                    b.Property<char>("Gendercode")
                        .HasMaxLength(1)
                        .HasColumnType("character(1)")
                        .HasColumnName("gendercode");

                    b.Property<string>("Lastname")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)")
                        .HasColumnName("lastname");

                    b.Property<string>("Patronymic")
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)")
                        .HasColumnName("patronymic");

                    b.Property<string>("Phone")
                        .IsRequired()
                        .HasMaxLength(20)
                        .HasColumnType("character varying(20)")
                        .HasColumnName("phone");

                    b.Property<string>("Photopath")
                        .HasMaxLength(1000)
                        .HasColumnType("character varying(1000)")
                        .HasColumnName("photopath");

                    b.Property<DateTime>("Registrationdate")
                        .HasColumnType("timestamp(6) without time zone")
                        .HasColumnName("registrationdate");

                    b.HasKey("Id")
                        .HasName("client_pkey");

                    b.HasIndex("Gendercode");

                    b.ToTable("client", "task16-09");
                });

            modelBuilder.Entity("Demo2.Models.Clientservice", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

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

                    b.Property<int>("Clientid")
                        .HasColumnType("integer")
                        .HasColumnName("clientid");

                    b.Property<string>("Comment")
                        .HasColumnType("text")
                        .HasColumnName("comment");

                    b.Property<int>("Serviceid")
                        .HasColumnType("integer")
                        .HasColumnName("serviceid");

                    b.Property<DateTime>("Starttime")
                        .HasColumnType("timestamp(6) without time zone")
                        .HasColumnName("starttime");

                    b.HasKey("Id")
                        .HasName("clientservice_pkey");

                    b.HasIndex("Clientid");

                    b.HasIndex("Serviceid");

                    b.ToTable("clientservice", "task16-09");
                });

            modelBuilder.Entity("Demo2.Models.Documentbyservice", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

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

                    b.Property<int>("Clientserviceid")
                        .HasColumnType("integer")
                        .HasColumnName("clientserviceid");

                    b.Property<string>("Documentpath")
                        .IsRequired()
                        .HasMaxLength(1000)
                        .HasColumnType("character varying(1000)")
                        .HasColumnName("documentpath");

                    b.HasKey("Id")
                        .HasName("documentbyservice_pkey");

                    b.HasIndex("Clientserviceid");

                    b.ToTable("documentbyservice", "task16-09");
                });

            modelBuilder.Entity("Demo2.Models.Gender", b =>
                {
                    b.Property<char>("Code")
                        .HasMaxLength(1)
                        .HasColumnType("character(1)")
                        .HasColumnName("code");

                    b.Property<string>("Name")
                        .HasMaxLength(10)
                        .HasColumnType("character varying(10)")
                        .HasColumnName("name");

                    b.HasKey("Code")
                        .HasName("gender_pkey");

                    b.ToTable("gender", "task16-09");
                });

            modelBuilder.Entity("Demo2.Models.Manufacturer", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

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

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("character varying(100)")
                        .HasColumnName("name");

                    b.Property<DateOnly?>("Startdate")
                        .HasColumnType("date")
                        .HasColumnName("startdate");

                    b.HasKey("Id")
                        .HasName("manufacturer_pkey");

                    b.ToTable("manufacturer", "task16-09");
                });

            modelBuilder.Entity("Demo2.Models.Product", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

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

                    b.Property<decimal>("Cost")
                        .HasPrecision(19, 4)
                        .HasColumnType("numeric(19,4)")
                        .HasColumnName("cost");

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

                    b.Property<int>("Isactive")
                        .HasColumnType("integer")
                        .HasColumnName("isactive");

                    b.Property<string>("Mainimagepath")
                        .HasMaxLength(1000)
                        .HasColumnType("character varying(1000)")
                        .HasColumnName("mainimagepath");

                    b.Property<int?>("Manufacturerid")
                        .HasColumnType("integer")
                        .HasColumnName("manufacturerid");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("character varying(100)")
                        .HasColumnName("title");

                    b.HasKey("Id")
                        .HasName("product_pkey");

                    b.HasIndex("Manufacturerid");

                    b.ToTable("product", "task16-09");
                });

            modelBuilder.Entity("Demo2.Models.Productphoto", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

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

                    b.Property<string>("Photopath")
                        .IsRequired()
                        .HasMaxLength(1000)
                        .HasColumnType("character varying(1000)")
                        .HasColumnName("photopath");

                    b.Property<int>("Productid")
                        .HasColumnType("integer")
                        .HasColumnName("productid");

                    b.HasKey("Id")
                        .HasName("productphoto_pkey");

                    b.HasIndex("Productid");

                    b.ToTable("productphoto", "task16-09");
                });

            modelBuilder.Entity("Demo2.Models.Productsale", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

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

                    b.Property<int?>("Clientserviceid")
                        .HasColumnType("integer")
                        .HasColumnName("clientserviceid");

                    b.Property<int>("Productid")
                        .HasColumnType("integer")
                        .HasColumnName("productid");

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

                    b.Property<DateTime>("Saledate")
                        .HasColumnType("timestamp(6) without time zone")
                        .HasColumnName("saledate");

                    b.HasKey("Id")
                        .HasName("productsale_pkey");

                    b.HasIndex("Clientserviceid");

                    b.HasIndex("Productid");

                    b.ToTable("productsale", "task16-09");
                });

            modelBuilder.Entity("Demo2.Models.Service", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

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

                    b.Property<decimal>("Cost")
                        .HasPrecision(19, 4)
                        .HasColumnType("numeric(19,4)")
                        .HasColumnName("cost");

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

                    b.Property<double?>("Discount")
                        .HasColumnType("double precision")
                        .HasColumnName("discount");

                    b.Property<int>("Durationinseconds")
                        .HasColumnType("integer")
                        .HasColumnName("durationinseconds");

                    b.Property<string>("Mainimagepath")
                        .HasMaxLength(1000)
                        .HasColumnType("character varying(1000)")
                        .HasColumnName("mainimagepath");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasMaxLength(100)
                        .HasColumnType("character varying(100)")
                        .HasColumnName("title");

                    b.HasKey("Id")
                        .HasName("service_pkey");

                    b.ToTable("service", "task16-09");
                });

            modelBuilder.Entity("Demo2.Models.Servicephoto", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasColumnName("id");

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

                    b.Property<string>("Photopath")
                        .IsRequired()
                        .HasMaxLength(1000)
                        .HasColumnType("character varying(1000)")
                        .HasColumnName("photopath");

                    b.Property<int>("Serviceid")
                        .HasColumnType("integer")
                        .HasColumnName("serviceid");

                    b.HasKey("Id")
                        .HasName("servicephoto_pkey");

                    b.HasIndex("Serviceid");

                    b.ToTable("servicephoto", "task16-09");
                });

            modelBuilder.Entity("Demo2.Models.Tag", b =>
                {
                    b.Property<int>("Id")
                        .HasColumnType("integer")
                        .HasColumnName("id");

                    b.Property<string>("Color")
                        .IsRequired()
                        .HasMaxLength(8)
                        .HasColumnType("character(8)")
                        .HasColumnName("color")
                        .IsFixedLength();

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasMaxLength(30)
                        .HasColumnType("character varying(30)")
                        .HasColumnName("title");

                    b.HasKey("Id")
                        .HasName("tag_pkey");

                    b.ToTable("tag", "task16-09");
                });

            modelBuilder.Entity("Tagofclient", b =>
                {
                    b.Property<int>("Clientid")
                        .HasColumnType("integer")
                        .HasColumnName("clientid");

                    b.Property<int>("Tagid")
                        .HasColumnType("integer")
                        .HasColumnName("tagid");

                    b.HasKey("Clientid", "Tagid")
                        .HasName("tagofclient_pkey");

                    b.HasIndex("Tagid");

                    b.ToTable("tagofclient", "task16-09");
                });

            modelBuilder.Entity("Attachedproduct", b =>
                {
                    b.HasOne("Demo2.Models.Product", null)
                        .WithMany()
                        .HasForeignKey("Attachedproductid")
                        .IsRequired()
                        .HasConstraintName("fk_attachedproduct_product1");

                    b.HasOne("Demo2.Models.Product", null)
                        .WithMany()
                        .HasForeignKey("Mainproductid")
                        .IsRequired()
                        .HasConstraintName("fk_attachedproduct_product");
                });

            modelBuilder.Entity("Demo2.Models.Client", b =>
                {
                    b.HasOne("Demo2.Models.Gender", "GendercodeNavigation")
                        .WithMany("Clients")
                        .HasForeignKey("Gendercode")
                        .IsRequired()
                        .HasConstraintName("fk_client_gender");

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

            modelBuilder.Entity("Demo2.Models.Clientservice", b =>
                {
                    b.HasOne("Demo2.Models.Client", "Client")
                        .WithMany("Clientservices")
                        .HasForeignKey("Clientid")
                        .IsRequired()
                        .HasConstraintName("fk_clientservice_client");

                    b.HasOne("Demo2.Models.Service", "Service")
                        .WithMany("Clientservices")
                        .HasForeignKey("Serviceid")
                        .IsRequired()
                        .HasConstraintName("fk_clientservice_service");

                    b.Navigation("Client");

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

            modelBuilder.Entity("Demo2.Models.Documentbyservice", b =>
                {
                    b.HasOne("Demo2.Models.Clientservice", "Clientservice")
                        .WithMany("Documentbyservices")
                        .HasForeignKey("Clientserviceid")
                        .IsRequired()
                        .HasConstraintName("fk_documentbyservice_clientservice");

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

            modelBuilder.Entity("Demo2.Models.Product", b =>
                {
                    b.HasOne("Demo2.Models.Manufacturer", "Manufacturer")
                        .WithMany("Products")
                        .HasForeignKey("Manufacturerid")
                        .HasConstraintName("fk_product_manufacturer");

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

            modelBuilder.Entity("Demo2.Models.Productphoto", b =>
                {
                    b.HasOne("Demo2.Models.Product", "Product")
                        .WithMany("Productphotos")
                        .HasForeignKey("Productid")
                        .IsRequired()
                        .HasConstraintName("fk_productphoto_product");

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

            modelBuilder.Entity("Demo2.Models.Productsale", b =>
                {
                    b.HasOne("Demo2.Models.Clientservice", "Clientservice")
                        .WithMany("Productsales")
                        .HasForeignKey("Clientserviceid")
                        .HasConstraintName("fk_productsale_clientservice");

                    b.HasOne("Demo2.Models.Product", "Product")
                        .WithMany("Productsales")
                        .HasForeignKey("Productid")
                        .IsRequired()
                        .HasConstraintName("fk_productsale_product");

                    b.Navigation("Clientservice");

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

            modelBuilder.Entity("Demo2.Models.Servicephoto", b =>
                {
                    b.HasOne("Demo2.Models.Service", "Service")
                        .WithMany("Servicephotos")
                        .HasForeignKey("Serviceid")
                        .IsRequired()
                        .HasConstraintName("fk_servicephoto_service");

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

            modelBuilder.Entity("Tagofclient", b =>
                {
                    b.HasOne("Demo2.Models.Client", null)
                        .WithMany()
                        .HasForeignKey("Clientid")
                        .IsRequired()
                        .HasConstraintName("fk_tagofclient_client");

                    b.HasOne("Demo2.Models.Tag", null)
                        .WithMany()
                        .HasForeignKey("Tagid")
                        .IsRequired()
                        .HasConstraintName("tagofclient_tag_fk");
                });

            modelBuilder.Entity("Demo2.Models.Client", b =>
                {
                    b.Navigation("Clientservices");
                });

            modelBuilder.Entity("Demo2.Models.Clientservice", b =>
                {
                    b.Navigation("Documentbyservices");

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

            modelBuilder.Entity("Demo2.Models.Gender", b =>
                {
                    b.Navigation("Clients");
                });

            modelBuilder.Entity("Demo2.Models.Manufacturer", b =>
                {
                    b.Navigation("Products");
                });

            modelBuilder.Entity("Demo2.Models.Product", b =>
                {
                    b.Navigation("Productphotos");

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

            modelBuilder.Entity("Demo2.Models.Service", b =>
                {
                    b.Navigation("Clientservices");

                    b.Navigation("Servicephotos");
                });
#pragma warning restore 612, 618
        }
    }
}
