﻿// <auto-generated />
using ArragroCMS.BusinessLayer.Data.EFCore;
using ArragroCMS.Core.Enums;
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 System;

namespace ArragroCMS.BusinessLayer.Data.EFCore.Migrations.ArragroCms
{
    [DbContext(typeof(ArragroCmsContext))]
    [Migration("20171005002654_Add-Sites")]
    partial class AddSites
    {
        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("ArragroCMS.BusinessLayer.Data.Entities.Asset", b =>
                {
                    b.Property<Guid>("AssetId")
                        .ValueGeneratedOnAdd();

                    b.Property<string>("Alt")
                        .HasMaxLength(128);

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

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

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

                    b.Property<string>("FileName")
                        .IsRequired()
                        .HasMaxLength(128);

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

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

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

                    b.Property<string>("MimeType")
                        .IsRequired()
                        .HasMaxLength(255);

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

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

                    b.Property<DateTime?>("OriginSyncDate");

                    b.Property<string>("OriginUrl")
                        .HasMaxLength(2000);

                    b.Property<Guid?>("ParentAssetId");

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

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

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

                    b.HasKey("AssetId");

                    b.HasIndex("ContentUrlRouteId");

                    b.HasIndex("ParentAssetId");

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

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

            modelBuilder.Entity("ArragroCMS.BusinessLayer.Data.Entities.Content", b =>
                {
                    b.Property<Guid>("ContentId");

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

                    b.Property<string>("Action")
                        .IsRequired()
                        .HasMaxLength(255);

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

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

                    b.Property<string>("ConfigurationTypeTypeFullName")
                        .HasMaxLength(255);

                    b.Property<string>("ControllerName")
                        .IsRequired()
                        .HasMaxLength(255);

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

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

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

                    b.Property<string>("Keywords")
                        .HasMaxLength(255);

                    b.Property<string>("Layout")
                        .IsRequired()
                        .HasMaxLength(255);

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

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

                    b.Property<string>("NavigationTitle")
                        .HasMaxLength(128);

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

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

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

                    b.Property<string>("PageDataTypeTypeFullName")
                        .IsRequired()
                        .HasMaxLength(255);

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

                    b.Property<Guid?>("ParentContentId");

                    b.Property<string>("RedirectUrl")
                        .HasMaxLength(2000);

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasMaxLength(128);

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

                    b.HasKey("ContentId", "Status");

                    b.HasIndex("ParentContentId");

                    b.HasIndex("UrlRouteId");

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

            modelBuilder.Entity("ArragroCMS.BusinessLayer.Data.Entities.Setting", b =>
                {
                    b.Property<int>("SettingId")
                        .ValueGeneratedOnAdd();

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

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

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

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

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

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

                    b.HasKey("SettingId");

                    b.HasIndex("Name")
                        .IsUnique()
                        .HasFilter("[Name] IS NOT NULL");

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

            modelBuilder.Entity("ArragroCMS.BusinessLayer.Data.Entities.Site", b =>
                {
                    b.Property<Guid>("SiteId")
                        .ValueGeneratedOnAdd();

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

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

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

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

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

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

                    b.Property<string>("Url")
                        .HasMaxLength(2000);

                    b.HasKey("SiteId");

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

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

            modelBuilder.Entity("ArragroCMS.BusinessLayer.Data.Entities.SupportedCulture", b =>
                {
                    b.Property<int>("SupportedCultureId")
                        .ValueGeneratedOnAdd();

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

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

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

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

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

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

                    b.HasKey("SupportedCultureId");

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

            modelBuilder.Entity("ArragroCMS.BusinessLayer.Data.Entities.Tag", b =>
                {
                    b.Property<int>("TagId")
                        .ValueGeneratedOnAdd();

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

                    b.HasKey("TagId");

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

            modelBuilder.Entity("ArragroCMS.BusinessLayer.Data.Entities.TagUrlRoute", b =>
                {
                    b.Property<int>("TagId");

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

                    b.HasKey("TagId", "UrlRouteId");

                    b.HasIndex("UrlRouteId");

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

            modelBuilder.Entity("ArragroCMS.BusinessLayer.Data.Entities.UrlRoute", b =>
                {
                    b.Property<Guid>("UrlRouteId")
                        .ValueGeneratedOnAdd();

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

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

                    b.Property<string>("DraftUrl")
                        .IsRequired()
                        .HasMaxLength(2000);

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

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

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

                    b.Property<string>("Url")
                        .IsRequired()
                        .HasMaxLength(2000);

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

                    b.HasKey("UrlRouteId");

                    b.HasIndex("UrlRouteType");

                    b.HasIndex("SiteId", "Url")
                        .IsUnique();

                    b.HasIndex("Url", "UrlRouteType");

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

            modelBuilder.Entity("ArragroCMS.BusinessLayer.Data.Entities.Asset", b =>
                {
                    b.HasOne("ArragroCMS.BusinessLayer.Data.Entities.UrlRoute", "ContentUrlRoute")
                        .WithMany("Assets")
                        .HasForeignKey("ContentUrlRouteId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ArragroCMS.BusinessLayer.Data.Entities.UrlRoute", "UrlRoute")
                        .WithOne("Asset")
                        .HasForeignKey("ArragroCMS.BusinessLayer.Data.Entities.Asset", "UrlRouteId")
                        .OnDelete(DeleteBehavior.Restrict);
                });

            modelBuilder.Entity("ArragroCMS.BusinessLayer.Data.Entities.Content", b =>
                {
                    b.HasOne("ArragroCMS.BusinessLayer.Data.Entities.UrlRoute", "UrlRoute")
                        .WithMany("Contents")
                        .HasForeignKey("UrlRouteId")
                        .OnDelete(DeleteBehavior.Restrict);
                });

            modelBuilder.Entity("ArragroCMS.BusinessLayer.Data.Entities.TagUrlRoute", b =>
                {
                    b.HasOne("ArragroCMS.BusinessLayer.Data.Entities.Tag", "Tag")
                        .WithMany("TagUrlRoutes")
                        .HasForeignKey("TagId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("ArragroCMS.BusinessLayer.Data.Entities.UrlRoute", "UrlRoute")
                        .WithMany("TagUrlRoutes")
                        .HasForeignKey("UrlRouteId")
                        .OnDelete(DeleteBehavior.Cascade);
                });

            modelBuilder.Entity("ArragroCMS.BusinessLayer.Data.Entities.UrlRoute", b =>
                {
                    b.HasOne("ArragroCMS.BusinessLayer.Data.Entities.Site", "Site")
                        .WithMany("UrlRoutes")
                        .HasForeignKey("SiteId")
                        .OnDelete(DeleteBehavior.Restrict);
                });
#pragma warning restore 612, 618
        }
    }
}
