// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage;
using Microsoft.EntityFrameworkCore.Storage.Internal;
using SmartValley.Data.SQL.Core;
using SmartValley.Domain.Entities;
using System;

namespace SmartValley.Data.SQL.Migrations
{
    [DbContext(typeof(AppDBContext))]
    [Migration("20180219091841_Expert")]
    partial class Expert
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "2.0.0-rtm-26452")
                .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

            modelBuilder.Entity("SmartValley.Domain.Entities.Application", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("BlockchainType")
                        .HasMaxLength(100);

                    b.Property<string>("FinancialModelLink")
                        .HasMaxLength(400);

                    b.Property<string>("HardCap")
                        .HasMaxLength(40);

                    b.Property<bool>("InvestmentsAreAttracted");

                    b.Property<string>("MvpLink")
                        .HasMaxLength(400);

                    b.Property<long>("ProjectId");

                    b.Property<string>("ProjectStatus")
                        .HasMaxLength(100);

                    b.Property<string>("SoftCap")
                        .HasMaxLength(40);

                    b.Property<string>("WhitePaperLink")
                        .HasMaxLength(400);

                    b.HasKey("Id");

                    b.HasIndex("ProjectId");

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

            modelBuilder.Entity("SmartValley.Domain.Entities.Area", b =>
                {
                    b.Property<int>("Id");

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

                    b.HasKey("Id");

                    b.HasIndex("Name")
                        .IsUnique();

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

            modelBuilder.Entity("SmartValley.Domain.Entities.EstimateComment", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd();

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

                    b.Property<string>("ExpertAddress")
                        .IsRequired()
                        .HasMaxLength(42);

                    b.Property<long>("ProjectId");

                    b.Property<long>("QuestionId");

                    b.HasKey("Id");

                    b.HasIndex("ProjectId");

                    b.HasIndex("QuestionId");

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

            modelBuilder.Entity("SmartValley.Domain.Entities.Expert", b =>
                {
                    b.Property<long>("UserId");

                    b.Property<bool>("IsAvailable");

                    b.HasKey("UserId");

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

            modelBuilder.Entity("SmartValley.Domain.Entities.ExpertApplication", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<long>("ApplicantId");

                    b.Property<DateTimeOffset>("ApplyDate");

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

                    b.Property<string>("City")
                        .IsRequired()
                        .HasMaxLength(50);

                    b.Property<string>("Country")
                        .IsRequired()
                        .HasMaxLength(100);

                    b.Property<string>("CvName")
                        .HasMaxLength(50);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(1500);

                    b.Property<string>("DocumentNumber")
                        .HasMaxLength(30);

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

                    b.Property<string>("FacebookLink")
                        .HasMaxLength(400);

                    b.Property<string>("FirstName")
                        .IsRequired()
                        .HasMaxLength(50);

                    b.Property<string>("LastName")
                        .IsRequired()
                        .HasMaxLength(50);

                    b.Property<string>("LinkedInLink")
                        .HasMaxLength(400);

                    b.Property<string>("PhotoName")
                        .HasMaxLength(50);

                    b.Property<string>("ScanName")
                        .HasMaxLength(50);

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

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

                    b.Property<string>("Why")
                        .IsRequired()
                        .HasMaxLength(1500);

                    b.HasKey("Id");

                    b.HasIndex("ApplicantId");

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

            modelBuilder.Entity("SmartValley.Domain.Entities.ExpertApplicationArea", b =>
                {
                    b.Property<long>("ExpertApplicationId");

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

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

                    b.HasKey("ExpertApplicationId", "AreaId");

                    b.HasIndex("AreaId");

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

            modelBuilder.Entity("SmartValley.Domain.Entities.ExpertArea", b =>
                {
                    b.Property<long>("ExpertId");

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

                    b.HasKey("ExpertId", "AreaId");

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

            modelBuilder.Entity("SmartValley.Domain.Entities.Project", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("AuthorAddress")
                        .IsRequired()
                        .HasMaxLength(42);

                    b.Property<string>("Country")
                        .HasMaxLength(100);

                    b.Property<string>("Description")
                        .IsRequired()
                        .HasMaxLength(1000);

                    b.Property<Guid>("ExternalId");

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

                    b.Property<string>("ProjectArea")
                        .IsRequired()
                        .HasMaxLength(100);

                    b.HasKey("Id");

                    b.HasIndex("ExternalId")
                        .IsUnique();

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

            modelBuilder.Entity("SmartValley.Domain.Entities.Question", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd();

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

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

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("SmartValley.Domain.Entities.Role", b =>
                {
                    b.Property<int>("Id");

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

                    b.HasKey("Id");

                    b.HasIndex("Name")
                        .IsUnique();

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

            modelBuilder.Entity("SmartValley.Domain.Entities.Scoring", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("ContractAddress")
                        .IsRequired()
                        .HasMaxLength(42);

                    b.Property<bool>("IsScoredByAnalyst");

                    b.Property<bool>("IsScoredByHr");

                    b.Property<bool>("IsScoredByLawyer");

                    b.Property<bool>("IsScoredByTechnical");

                    b.Property<long>("ProjectId");

                    b.Property<double?>("Score");

                    b.HasKey("Id");

                    b.HasIndex("ProjectId")
                        .IsUnique();

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

            modelBuilder.Entity("SmartValley.Domain.Entities.TeamMember", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<long>("ApplicationId");

                    b.Property<string>("FacebookLink")
                        .HasMaxLength(200);

                    b.Property<string>("FullName")
                        .IsRequired()
                        .HasMaxLength(100);

                    b.Property<string>("LinkedInLink")
                        .HasMaxLength(200);

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

                    b.HasKey("Id");

                    b.HasIndex("ApplicationId");

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

            modelBuilder.Entity("SmartValley.Domain.Entities.User", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("About");

                    b.Property<string>("Address")
                        .IsRequired()
                        .HasMaxLength(42);

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

                    b.Property<bool>("IsEmailConfirmed");

                    b.Property<string>("Name");

                    b.HasKey("Id");

                    b.HasIndex("Address")
                        .IsUnique();

                    b.HasIndex("Email")
                        .IsUnique();

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

            modelBuilder.Entity("SmartValley.Domain.Entities.UserRole", b =>
                {
                    b.Property<long>("UserId");

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

                    b.HasKey("UserId", "RoleId");

                    b.HasIndex("RoleId");

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

            modelBuilder.Entity("SmartValley.Domain.Entities.Voting", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd();

                    b.Property<DateTimeOffset>("EndDate");

                    b.Property<DateTimeOffset>("StartDate");

                    b.Property<string>("VotingAddress")
                        .IsRequired()
                        .HasMaxLength(42);

                    b.HasKey("Id");

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

            modelBuilder.Entity("SmartValley.Domain.Entities.VotingProject", b =>
                {
                    b.Property<long>("ProjectId");

                    b.Property<long>("VotingId");

                    b.HasKey("ProjectId", "VotingId");

                    b.HasIndex("VotingId");

                    b.HasIndex("ProjectId", "VotingId");

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

            modelBuilder.Entity("SmartValley.Domain.Entities.Application", b =>
                {
                    b.HasOne("SmartValley.Domain.Entities.Project", "Project")
                        .WithMany()
                        .HasForeignKey("ProjectId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("SmartValley.Domain.Entities.EstimateComment", b =>
                {
                    b.HasOne("SmartValley.Domain.Entities.Project", "Project")
                        .WithMany()
                        .HasForeignKey("ProjectId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("SmartValley.Domain.Entities.Question", "Question")
                        .WithMany()
                        .HasForeignKey("QuestionId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("SmartValley.Domain.Entities.Expert", b =>
                {
                    b.HasOne("SmartValley.Domain.Entities.User", "User")
                        .WithOne("Expert")
                        .HasForeignKey("SmartValley.Domain.Entities.Expert", "UserId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("SmartValley.Domain.Entities.ExpertApplication", b =>
                {
                    b.HasOne("SmartValley.Domain.Entities.User", "Applicant")
                        .WithMany()
                        .HasForeignKey("ApplicantId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("SmartValley.Domain.Entities.ExpertApplicationArea", b =>
                {
                    b.HasOne("SmartValley.Domain.Entities.Area")
                        .WithMany("ExpertApplicationAreas")
                        .HasForeignKey("AreaId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("SmartValley.Domain.Entities.ExpertApplication", "ExpertApplication")
                        .WithMany()
                        .HasForeignKey("ExpertApplicationId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("SmartValley.Domain.Entities.ExpertArea", b =>
                {
                    b.HasOne("SmartValley.Domain.Entities.Expert", "Expert")
                        .WithMany("ExpertAreas")
                        .HasForeignKey("ExpertId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("SmartValley.Domain.Entities.Scoring", b =>
                {
                    b.HasOne("SmartValley.Domain.Entities.Project", "Project")
                        .WithMany()
                        .HasForeignKey("ProjectId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("SmartValley.Domain.Entities.TeamMember", b =>
                {
                    b.HasOne("SmartValley.Domain.Entities.Application", "Application")
                        .WithMany()
                        .HasForeignKey("ApplicationId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("SmartValley.Domain.Entities.UserRole", b =>
                {
                    b.HasOne("SmartValley.Domain.Entities.Role")
                        .WithMany("UserRoles")
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("SmartValley.Domain.Entities.User")
                        .WithMany("UserRoles")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("SmartValley.Domain.Entities.VotingProject", b =>
                {
                    b.HasOne("SmartValley.Domain.Entities.Project", "Project")
                        .WithMany()
                        .HasForeignKey("ProjectId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("SmartValley.Domain.Entities.Voting", "Voting")
                        .WithMany()
                        .HasForeignKey("VotingId")
                        .OnDelete(DeleteBehavior.Cascade);
                });
#pragma warning restore 612, 618
        }
    }
}
