// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using PARR.DAL.Context;

#nullable disable

namespace PARR.DAL.Migrations
{
    [DbContext(typeof(DataContext))]
    [Migration("20230621014955_DbV5")]
    partial class DbV5
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "7.0.5")
                .HasAnnotation("Relational:MaxIdentifierLength", 63);

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("PARR.DAL.Models.Application", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<Guid>("ApplicationTypeId")
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("DateCreated")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTimeOffset?>("DateModified")
                        .HasColumnType("timestamp with time zone");

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

                    b.HasKey("Id");

                    b.HasIndex("ApplicationTypeId");

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

            modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<Guid>("ApplicationId")
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("DateCreated")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTimeOffset?>("DateModified")
                        .HasColumnType("timestamp with time zone");

                    b.Property<Guid>("HostId")
                        .HasColumnType("uuid");

                    b.HasKey("Id");

                    b.HasIndex("ApplicationId");

                    b.HasIndex("HostId");

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

            modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<Guid?>("ApplicationTypeId")
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("DateCreated")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTimeOffset?>("DateModified")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Description")
                        .HasColumnType("text");

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

                    b.HasKey("Id");

                    b.HasIndex("ApplicationTypeId");

                    b.ToTable("ApplicationTypes");

                    b.HasData(
                        new
                        {
                            Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"),
                            DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
                            Description = "Поле СП xml АИХ ИТ",
                            Name = "APP"
                        },
                        new
                        {
                            Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"),
                            DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
                            Description = "Поле ОС xml АИХ ИТ",
                            Name = "OS"
                        },
                        new
                        {
                            Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"),
                            DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
                            Description = "Поле СУБД xml АИХ ИТ",
                            Name = "DB"
                        });
                });

            modelBuilder.Entity("PARR.DAL.Models.Host", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("DateCreated")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTimeOffset?>("DateModified")
                        .HasColumnType("timestamp with time zone");

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

                    b.Property<string>("IP")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<string>("LinkEK")
                        .HasColumnType("text");

                    b.Property<string>("RegionalEK")
                        .HasColumnType("text");

                    b.Property<string>("Responsible")
                        .HasColumnType("text");

                    b.Property<string>("Status")
                        .HasColumnType("text");

                    b.Property<string>("WorkGroup")
                        .HasColumnType("text");

                    b.HasKey("Id");

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

            modelBuilder.Entity("PARR.DAL.Models.Job", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<Guid>("ApplicationId")
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("DateCreated")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTimeOffset?>("DateModified")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("Frequency")
                        .HasColumnType("integer");

                    b.Property<bool>("IsEnabled")
                        .HasColumnType("boolean");

                    b.Property<Guid?>("JobCategoryId")
                        .HasColumnType("uuid");

                    b.Property<Guid>("JobModeId")
                        .HasColumnType("uuid");

                    b.Property<Guid>("JobTypeId")
                        .HasColumnType("uuid");

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

                    b.Property<string>("ScriptName")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<DateTimeOffset>("StartAt")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("Id");

                    b.HasIndex("ApplicationId");

                    b.HasIndex("JobCategoryId");

                    b.HasIndex("JobModeId");

                    b.HasIndex("JobTypeId");

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

            modelBuilder.Entity("PARR.DAL.Models.JobCategory", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("DateCreated")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTimeOffset?>("DateModified")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Description")
                        .HasColumnType("text");

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("PARR.DAL.Models.JobJournal", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("DateCreated")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTimeOffset?>("DateModified")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTimeOffset>("DateOper")
                        .HasColumnType("timestamp with time zone");

                    b.Property<Guid>("HostId")
                        .HasColumnType("uuid");

                    b.Property<string>("Info")
                        .HasColumnType("text");

                    b.Property<Guid>("JobId")
                        .HasColumnType("uuid");

                    b.Property<Guid>("JobStatusId")
                        .HasColumnType("uuid");

                    b.Property<string>("Other")
                        .HasColumnType("text");

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

                    b.HasKey("Id");

                    b.HasIndex("HostId");

                    b.HasIndex("JobId");

                    b.HasIndex("JobStatusId");

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

            modelBuilder.Entity("PARR.DAL.Models.JobMode", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("DateCreated")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTimeOffset?>("DateModified")
                        .HasColumnType("timestamp with time zone");

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

                    b.HasKey("Id");

                    b.ToTable("JobModes");

                    b.HasData(
                        new
                        {
                            Id = new Guid("fba4202c-5bad-49c4-b076-d1ca6e1fb158"),
                            DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
                            Name = "auto"
                        },
                        new
                        {
                            Id = new Guid("7516b952-510d-4aaa-971c-a14b184fc1d5"),
                            DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
                            Name = "manual"
                        });
                });

            modelBuilder.Entity("PARR.DAL.Models.JobStatus", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("DateCreated")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTimeOffset?>("DateModified")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Description")
                        .HasColumnType("text");

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

                    b.HasKey("Id");

                    b.ToTable("JobStatuses");

                    b.HasData(
                        new
                        {
                            Id = new Guid("edef6dc3-adad-4c77-8ad1-63bb9052355a"),
                            DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
                            Description = "Задание запущено",
                            Name = "started"
                        },
                        new
                        {
                            Id = new Guid("7b945eb6-d885-4570-aff5-8866f1f75ff2"),
                            DateCreated = new DateTimeOffset(new DateTime(2023, 5, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0)),
                            Description = "Задание выполнено",
                            Name = "finished"
                        });
                });

            modelBuilder.Entity("PARR.DAL.Models.JobType", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

                    b.Property<DateTimeOffset>("DateCreated")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTimeOffset?>("DateModified")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("Description")
                        .HasColumnType("text");

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

                    b.HasKey("Id");

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

            modelBuilder.Entity("PARR.DAL.Models.Application", b =>
                {
                    b.HasOne("PARR.DAL.Models.V1_ApplicationType", "V1_ApplicationType")
                        .WithMany()
                        .HasForeignKey("ApplicationTypeId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("V1_ApplicationType");
                });

            modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
                {
                    b.HasOne("PARR.DAL.Models.Application", "Application")
                        .WithMany("ApplicationsInHosts")
                        .HasForeignKey("ApplicationId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("PARR.DAL.Models.Host", "Host")
                        .WithMany("ApplicationsInHosts")
                        .HasForeignKey("HostId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Application");

                    b.Navigation("Host");
                });

            modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
                {
                    b.HasOne("PARR.DAL.Models.V1_ApplicationType", null)
                        .WithMany("ApplicationTypes")
                        .HasForeignKey("ApplicationTypeId");
                });

            modelBuilder.Entity("PARR.DAL.Models.Job", b =>
                {
                    b.HasOne("PARR.DAL.Models.Application", "Application")
                        .WithMany()
                        .HasForeignKey("ApplicationId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("PARR.DAL.Models.JobCategory", "JobCategorye")
                        .WithMany("Jobs")
                        .HasForeignKey("JobCategoryId");

                    b.HasOne("PARR.DAL.Models.JobMode", "JobMode")
                        .WithMany("Jobs")
                        .HasForeignKey("JobModeId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("PARR.DAL.Models.JobType", "JobType")
                        .WithMany("Jobs")
                        .HasForeignKey("JobTypeId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Application");

                    b.Navigation("JobCategorye");

                    b.Navigation("JobMode");

                    b.Navigation("JobType");
                });

            modelBuilder.Entity("PARR.DAL.Models.JobJournal", b =>
                {
                    b.HasOne("PARR.DAL.Models.Host", "Host")
                        .WithMany("JobJournals")
                        .HasForeignKey("HostId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("PARR.DAL.Models.Job", "Job")
                        .WithMany("Journals")
                        .HasForeignKey("JobId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("PARR.DAL.Models.JobStatus", "Status")
                        .WithMany("Journals")
                        .HasForeignKey("JobStatusId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Host");

                    b.Navigation("Job");

                    b.Navigation("Status");
                });

            modelBuilder.Entity("PARR.DAL.Models.Application", b =>
                {
                    b.Navigation("ApplicationsInHosts");
                });

            modelBuilder.Entity("PARR.DAL.Models.V1_ApplicationType", b =>
                {
                    b.Navigation("ApplicationTypes");
                });

            modelBuilder.Entity("PARR.DAL.Models.Host", b =>
                {
                    b.Navigation("ApplicationsInHosts");

                    b.Navigation("JobJournals");
                });

            modelBuilder.Entity("PARR.DAL.Models.Job", b =>
                {
                    b.Navigation("Journals");
                });

            modelBuilder.Entity("PARR.DAL.Models.JobCategory", b =>
                {
                    b.Navigation("Jobs");
                });

            modelBuilder.Entity("PARR.DAL.Models.JobMode", b =>
                {
                    b.Navigation("Jobs");
                });

            modelBuilder.Entity("PARR.DAL.Models.JobStatus", b =>
                {
                    b.Navigation("Journals");
                });

            modelBuilder.Entity("PARR.DAL.Models.JobType", b =>
                {
                    b.Navigation("Jobs");
                });
#pragma warning restore 612, 618
        }
    }
}
