﻿// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using cd.Infrastructure.Iis.Data;

namespace cd.Infrastructure.Iis.Data
{
    [DbContext(typeof(IisLogDbContext))]
    partial class IisLogDbContextModelSnapshot : ModelSnapshot
    {
        protected override void BuildModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasDefaultSchema("iis")
                .HasAnnotation("ProductVersion", "5.0.0-preview.3.20181.2")
                .HasAnnotation("Relational:MaxIdentifierLength", 128)
                .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

            modelBuilder.Entity("cd.Domain.WebTraffic.Models.IisLogEntry", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<string>("Cookie")
                        .HasColumnType("nvarchar(max)");

                    b.Property<DateTime>("DateAccessed")
                        .HasColumnType("datetime2");

                    b.Property<string>("Host")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("HttpMethod")
                        .HasColumnType("nvarchar(max)");

                    b.Property<int?>("IisLogFileId")
                        .HasColumnType("int");

                    b.Property<int?>("IisSiteId")
                        .HasColumnType("int");

                    b.Property<string>("IpAddress")
                        .HasColumnType("nvarchar(max)");

                    b.Property<int>("Port")
                        .HasColumnType("int");

                    b.Property<string>("Referer")
                        .HasColumnType("nvarchar(max)");

                    b.Property<int?>("StagedIisLogEntryId")
                        .HasColumnType("int");

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

                    b.Property<string>("UriQuery")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("UriStem")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("UserAgent")
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("Id");

                    b.HasIndex("IisLogFileId");

                    b.HasIndex("IisSiteId");

                    b.HasIndex("StagedIisLogEntryId");

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

            modelBuilder.Entity("cd.Domain.WebTraffic.Models.IisLogFile", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<DateTime>("DateImported")
                        .HasColumnType("datetime2");

                    b.Property<DateTime>("FileDate")
                        .HasColumnType("datetime2");

                    b.Property<string>("HostName")
                        .HasColumnType("nvarchar(450)");

                    b.Property<int?>("IisSiteId")
                        .HasColumnType("int");

                    b.Property<string>("LogFileAndPath")
                        .HasColumnType("nvarchar(450)");

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

                    b.HasKey("Id");

                    b.HasIndex("FileDate");

                    b.HasIndex("HostName");

                    b.HasIndex("IisSiteId");

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

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

            modelBuilder.Entity("cd.Domain.WebTraffic.Models.IisSite", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<string>("HostName")
                        .HasColumnType("nvarchar(450)");

                    b.Property<int>("IisId")
                        .HasColumnType("int");

                    b.HasKey("Id");

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

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

            modelBuilder.Entity("cd.Domain.WebTraffic.Models.StagedIisLogEntry", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int")
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<string>("CIp")
                        .HasColumnName("c-ip")
                        .HasColumnType("nvarchar(48)")
                        .HasMaxLength(48);

                    b.Property<string>("CsBytes")
                        .HasColumnName("cs-bytes")
                        .HasColumnType("nvarchar(48)")
                        .HasMaxLength(48);

                    b.Property<string>("CsCookie")
                        .HasColumnName("cs(Cookie)")
                        .HasColumnType("nvarchar(1024)")
                        .HasMaxLength(1024);

                    b.Property<string>("CsHost")
                        .HasColumnName("cs-host")
                        .HasColumnType("nvarchar(48)")
                        .HasMaxLength(48);

                    b.Property<string>("CsMethod")
                        .HasColumnName("cs-method")
                        .HasColumnType("nvarchar(8)")
                        .HasMaxLength(8);

                    b.Property<string>("CsReferer")
                        .HasColumnName("cs(Referer)")
                        .HasColumnType("nvarchar(max)")
                        .HasMaxLength(4096);

                    b.Property<string>("CsUriQuery")
                        .HasColumnName("cs-uri-query")
                        .HasColumnType("nvarchar(2048)")
                        .HasMaxLength(2048);

                    b.Property<string>("CsUriStem")
                        .HasColumnName("cs-uri-stem")
                        .HasColumnType("nvarchar(255)")
                        .HasMaxLength(255);

                    b.Property<string>("CsUserAgent")
                        .HasColumnName("cs(User-Agent)")
                        .HasColumnType("nvarchar(1024)")
                        .HasMaxLength(1024);

                    b.Property<string>("CsUsername")
                        .HasColumnName("cs-username")
                        .HasColumnType("nvarchar(256)")
                        .HasMaxLength(256);

                    b.Property<string>("CsVersion")
                        .HasColumnName("cs-version")
                        .HasColumnType("nvarchar(48)")
                        .HasMaxLength(48);

                    b.Property<string>("Date")
                        .HasColumnName("Date")
                        .HasColumnType("nvarchar(10)")
                        .HasMaxLength(10);

                    b.Property<int?>("IisLogFileId")
                        .HasColumnType("int");

                    b.Property<string>("LogFileAndPath")
                        .HasColumnType("nvarchar(2048)")
                        .HasMaxLength(2048);

                    b.Property<string>("SComputerName")
                        .HasColumnName("s-computername")
                        .HasColumnType("nvarchar(48)")
                        .HasMaxLength(48);

                    b.Property<string>("SIp")
                        .HasColumnName("s-ip")
                        .HasColumnType("nvarchar(48)")
                        .HasMaxLength(48);

                    b.Property<string>("SPort")
                        .HasColumnName("s-port")
                        .HasColumnType("nvarchar(4)")
                        .HasMaxLength(4);

                    b.Property<string>("SSiteName")
                        .HasColumnName("s-sitename")
                        .HasColumnType("nvarchar(48)")
                        .HasMaxLength(48);

                    b.Property<string>("ScByptes")
                        .HasColumnName("sc-bytes")
                        .HasColumnType("nvarchar(48)")
                        .HasMaxLength(48);

                    b.Property<string>("ScStatus")
                        .HasColumnName("sc-STATUS")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("ScSubStatus")
                        .HasColumnName("sc-substatus")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("ScWin32Status")
                        .HasColumnName("sc-win32-STATUS")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Time")
                        .HasColumnName("Time")
                        .HasColumnType("nvarchar(8)")
                        .HasMaxLength(8);

                    b.Property<string>("TimeTaken")
                        .HasColumnName("time-taken")
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("Id");

                    b.HasIndex("IisLogFileId");

                    b.HasIndex("LogFileAndPath");

                    b.HasIndex("CsHost", "Date", "Time");

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

            modelBuilder.Entity("cd.Domain.WebTraffic.Models.IisLogEntry", b =>
                {
                    b.HasOne("cd.Domain.WebTraffic.Models.IisLogFile", "IisLogFile")
                        .WithMany("LogEntries")
                        .HasForeignKey("IisLogFileId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("cd.Domain.WebTraffic.Models.IisSite", "IisSite")
                        .WithMany("LogEntries")
                        .HasForeignKey("IisSiteId");

                    b.HasOne("cd.Domain.WebTraffic.Models.StagedIisLogEntry", "StagedIisLogEntry")
                        .WithMany()
                        .HasForeignKey("StagedIisLogEntryId");
                });

            modelBuilder.Entity("cd.Domain.WebTraffic.Models.IisLogFile", b =>
                {
                    b.HasOne("cd.Domain.WebTraffic.Models.IisSite", "IisSite")
                        .WithMany("LogFiles")
                        .HasForeignKey("IisSiteId");
                });

            modelBuilder.Entity("cd.Domain.WebTraffic.Models.StagedIisLogEntry", b =>
                {
                    b.HasOne("cd.Domain.WebTraffic.Models.IisLogFile", "IisLogFile")
                        .WithMany("StagedLogEntries")
                        .HasForeignKey("IisLogFileId")
                        .OnDelete(DeleteBehavior.Cascade);
                });
#pragma warning restore 612, 618
        }
    }
}
