using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;

namespace ShoeShopMvc.Models;

public partial class ShoeShopContext : DbContext
{
    public ShoeShopContext()
    {
    }

    public ShoeShopContext(DbContextOptions<ShoeShopContext> options)
        : base(options)
    {
    }

    public virtual DbSet<Category> Categories { get; set; }

    public virtual DbSet<Edizm> Edizms { get; set; }

    public virtual DbSet<Manufacture> Manufactures { get; set; }

    public virtual DbSet<Order> Orders { get; set; }

    public virtual DbSet<OrderProduct> OrderProducts { get; set; }

    public virtual DbSet<PickPoint> PickPoints { get; set; }

    public virtual DbSet<Product> Products { get; set; }

    public virtual DbSet<Role> Roles { get; set; }

    public virtual DbSet<Supplier> Suppliers { get; set; }

    public virtual DbSet<User> Users { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
        => optionsBuilder.UseSqlServer("Server=DESKTOP-7S4CGG7\\SQLEXPRESS;Database=826;Trusted_Connection=True;TrustServerCertificate=True;");

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<Category>(entity =>
        {
            entity.ToTable("Category");

            entity.Property(e => e.CategoryId)
                .HasMaxLength(50)
                .HasColumnName("category_id");
            entity.Property(e => e.CategoryName)
                .HasMaxLength(50)
                .HasColumnName("category_name");
        });

        modelBuilder.Entity<Edizm>(entity =>
        {
            entity.HasKey(e => e.IdEdIzm);

            entity.ToTable("edizm");

            entity.Property(e => e.IdEdIzm)
                .HasMaxLength(50)
                .HasColumnName("id_ed_izm");
            entity.Property(e => e.EdIzm1)
                .HasMaxLength(50)
                .HasColumnName("ed_izm");
        });

        modelBuilder.Entity<Manufacture>(entity =>
        {
            entity.ToTable("Manufacture");

            entity.Property(e => e.ManufactureId)
                .HasMaxLength(50)
                .HasColumnName("manufacture_id");
            entity.Property(e => e.ManufactureName)
                .HasMaxLength(50)
                .HasColumnName("manufacture_name");
        });

        modelBuilder.Entity<Order>(entity =>
        {
            entity.HasKey(e => e.OrdersId);

            entity.Property(e => e.OrdersId)
                .HasMaxLength(50)
                .HasColumnName("orders_id");
            entity.Property(e => e.ClientId)
                .HasMaxLength(50)
                .HasColumnName("client_id");
            entity.Property(e => e.Cod).HasColumnName("cod");
            entity.Property(e => e.DeliveryDate).HasColumnName("delivery_date");
            entity.Property(e => e.OrdersDate)
                .HasMaxLength(50)
                .HasColumnName("orders_date");
            entity.Property(e => e.AddressPickpoints)
                .HasMaxLength(50)
                .HasColumnName("PickPoints_id");
            entity.Property(e => e.StatusId)
                .HasMaxLength(50)
                .HasColumnName("status_id");
        });

        modelBuilder.Entity<OrderProduct>(entity =>
        {
            entity.HasKey(e => e.OrderProductsId);

            entity.ToTable("OrderProduct");

            entity.Property(e => e.OrderProductsId)
                .HasMaxLength(50)
                .HasColumnName("OrderProducts_id");
            entity.Property(e => e.Article)
                .HasMaxLength(50)
                .HasColumnName("article");
            entity.Property(e => e.Colvo)
                .HasMaxLength(50)
                .HasColumnName("colvo");
            entity.Property(e => e.OrdersId)
                .HasMaxLength(50)
                .HasColumnName("orders_id");
        });

        modelBuilder.Entity<PickPoint>(entity =>
        {
            entity.HasKey(e => e.PickPointsId);

            entity.Property(e => e.PickPointsId)
                .HasMaxLength(50)
                .HasColumnName("PickPoints_id");
            entity.Property(e => e.AddressPickpoints)
                .HasMaxLength(50)
                .HasColumnName("Address_pickpoints");
        });

        modelBuilder.Entity<Product>(entity =>
        {
            entity.HasKey(e => e.Article);

            entity.ToTable("Product");

            entity.Property(e => e.Article)
                .HasMaxLength(50)
                .HasColumnName("article");
            entity.Property(e => e.CategoryId)
                .HasMaxLength(50)
                .HasColumnName("category_id");
            entity.Property(e => e.Colvo)
                .HasMaxLength(50)
                .HasColumnName("colvo");
            entity.Property(e => e.EdIzm)
                .HasMaxLength(50)
                .HasColumnName("ed_izm");
            entity.Property(e => e.Image)
                .HasMaxLength(50)
                .HasColumnName("image");
            entity.Property(e => e.ManufactureId)
                .HasMaxLength(50)
                .HasColumnName("manufacture_id");
            entity.Property(e => e.OpisanieProduct)
                .HasMaxLength(100)
                .HasColumnName("opisanie_product");
            entity.Property(e => e.Price).HasColumnName("price");
            entity.Property(e => e.ProductName)
                .HasMaxLength(50)
                .HasColumnName("product_name");
            entity.Property(e => e.Skidka).HasColumnName("skidka");
            entity.Property(e => e.SupplierId)
                .HasMaxLength(50)
                .HasColumnName("supplier_id");
        });

        modelBuilder.Entity<Role>(entity =>
        {
            entity.Property(e => e.RoleId)
                .HasMaxLength(50)
                .HasColumnName("role_id");
            entity.Property(e => e.RoleName)
                .HasMaxLength(50)
                .HasColumnName("role_name");
        });

        modelBuilder.Entity<Supplier>(entity =>
        {
            entity.ToTable("suppliers");

            entity.Property(e => e.SupplierId)
                .HasMaxLength(50)
                .HasColumnName("supplier_id");
            entity.Property(e => e.SupplierName)
                .HasMaxLength(50)
                .HasColumnName("supplier_name");
        });

        modelBuilder.Entity<User>(entity =>
        {
            entity.Property(e => e.UserId)
                .HasMaxLength(50)
                .HasColumnName("user_id");
            entity.Property(e => e.Fio)
                .HasMaxLength(50)
                .HasColumnName("FIO");
            entity.Property(e => e.Login).HasMaxLength(50);
            entity.Property(e => e.Password).HasMaxLength(50);
            entity.Property(e => e.RoleId)
                .HasMaxLength(50)
                .HasColumnName("role_id");
        });

        OnModelCreatingPartial(modelBuilder);
    }

    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
