// <auto-generated />
using System;
using Alura.LeilaoOnline.WebApp.Dados;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

namespace Alura.LeilaoOnline.WebApp.Dados.Migrations
{
    [DbContext(typeof(LeiloesContext))]
    [Migration("20190411195218_Inicial")]
    partial class Inicial
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "2.2.2-servicing-10034")
                .HasAnnotation("Relational:MaxIdentifierLength", 128)
                .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

            modelBuilder.Entity("Alura.LeilaoOnline.Core.Interessada", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<string>("Nome")
                        .IsRequired();

                    b.HasKey("Id");

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

            modelBuilder.Entity("Alura.LeilaoOnline.Core.Lance", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<int>("ClienteId");

                    b.Property<int>("LeilaoId");

                    b.Property<double>("Valor");

                    b.HasKey("Id");

                    b.HasIndex("ClienteId");

                    b.HasIndex("LeilaoId");

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

            modelBuilder.Entity("Alura.LeilaoOnline.Core.Leilao", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<string>("Categoria")
                        .IsRequired();

                    b.Property<string>("Descricao")
                        .IsRequired();

                    b.Property<string>("Estado")
                        .IsRequired();

                    b.Property<int?>("GanhadorId");

                    b.Property<string>("Imagem")
                        .IsRequired();

                    b.Property<DateTime>("InicioPregao");

                    b.Property<DateTime>("TerminoPregao");

                    b.Property<string>("Titulo")
                        .IsRequired();

                    b.Property<double>("ValorInicial");

                    b.HasKey("Id");

                    b.HasIndex("GanhadorId");

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

            modelBuilder.Entity("Alura.LeilaoOnline.Core.Lance", b =>
                {
                    b.HasOne("Alura.LeilaoOnline.Core.Interessada", "Cliente")
                        .WithMany("Lances")
                        .HasForeignKey("ClienteId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("Alura.LeilaoOnline.Core.Leilao", "Leilao")
                        .WithMany("Lances")
                        .HasForeignKey("LeilaoId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("Alura.LeilaoOnline.Core.Leilao", b =>
                {
                    b.HasOne("Alura.LeilaoOnline.Core.Lance", "Ganhador")
                        .WithMany()
                        .HasForeignKey("GanhadorId");
                });
#pragma warning restore 612, 618
        }
    }
}
