// <auto-generated />
using System;
using DD.Persistence.Database.Model;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace DD.Persistence.Database.Postgres.Migrations
{
    [DbContext(typeof(PersistencePostgresContext))]
    [Migration("20241218105317_Init")]
    partial class Init
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .UseCollation("C.UTF-8")
                .HasAnnotation("ProductVersion", "8.0.10")
                .HasAnnotation("Relational:MaxIdentifierLength", 63);

            NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack");
            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("DD.Persistence.Database.Entity.DataSourceSystem", b =>
                {
                    b.Property<Guid>("SystemId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid")
                        .HasComment("Id системы - источника данных");

                    b.Property<string>("Description")
                        .HasColumnType("text")
                        .HasComment("Описание системы - источника данных");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("varchar(256)")
                        .HasComment("Наименование системы - источника данных");

                    b.HasKey("SystemId");

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

            modelBuilder.Entity("DD.Persistence.Database.Entity.ParameterData", b =>
                {
                    b.Property<Guid>("DiscriminatorId")
                        .HasColumnType("uuid")
                        .HasComment("Дискриминатор системы");

                    b.Property<int>("ParameterId")
                        .HasColumnType("integer")
                        .HasComment("Id параметра");

                    b.Property<DateTimeOffset>("Timestamp")
                        .HasColumnType("timestamp with time zone")
                        .HasComment("Временная отметка");

                    b.Property<string>("Value")
                        .IsRequired()
                        .HasColumnType("varchar(256)")
                        .HasComment("Значение параметра в виде строки");

                    b.HasKey("DiscriminatorId", "ParameterId", "Timestamp");

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

            modelBuilder.Entity("DD.Persistence.Database.Entity.TechMessage", b =>
                {
                    b.Property<Guid>("EventId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid")
                        .HasComment("Id события");

                    b.Property<int>("CategoryId")
                        .HasColumnType("integer")
                        .HasComment("Id Категории важности");

                    b.Property<int>("EventState")
                        .HasColumnType("integer")
                        .HasComment("Статус события");

                    b.Property<Guid>("SystemId")
                        .HasColumnType("uuid")
                        .HasComment("Id системы, к которой относится сообщение");

                    b.Property<string>("Text")
                        .IsRequired()
                        .HasColumnType("varchar(512)")
                        .HasComment("Текст сообщения");

                    b.Property<DateTimeOffset>("Timestamp")
                        .HasColumnType("timestamp with time zone")
                        .HasComment("Дата возникновения");

                    b.HasKey("EventId");

                    b.HasIndex("SystemId");

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

            modelBuilder.Entity("DD.Persistence.Database.Entity.TimestampedSet", b =>
                {
                    b.Property<Guid>("IdDiscriminator")
                        .HasColumnType("uuid")
                        .HasComment("Дискриминатор ссылка на тип сохраняемых данных");

                    b.Property<DateTimeOffset>("Timestamp")
                        .HasColumnType("timestamp with time zone")
                        .HasComment("Отметка времени, строго в UTC");

                    b.Property<string>("Set")
                        .IsRequired()
                        .HasColumnType("jsonb")
                        .HasComment("Набор сохраняемых данных");

                    b.HasKey("IdDiscriminator", "Timestamp");

                    b.ToTable("TimestampedSets", t =>
                        {
                            t.HasComment("Общая таблица данных временных рядов");
                        });
                });

            modelBuilder.Entity("DD.Persistence.Database.Model.ChangeLog", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid")
                        .HasComment("Ключ записи");

                    b.Property<DateTimeOffset>("Creation")
                        .HasColumnType("timestamp with time zone")
                        .HasComment("Дата создания записи");

                    b.Property<double>("DepthEnd")
                        .HasColumnType("double precision")
                        .HasComment("Глубина забоя на дату окончания интервала");

                    b.Property<double>("DepthStart")
                        .HasColumnType("double precision")
                        .HasComment("Глубина забоя на дату начала интервала");

                    b.Property<Guid>("IdAuthor")
                        .HasColumnType("uuid")
                        .HasComment("Автор изменения");

                    b.Property<Guid>("IdDiscriminator")
                        .HasColumnType("uuid")
                        .HasComment("Дискриминатор таблицы");

                    b.Property<Guid?>("IdEditor")
                        .HasColumnType("uuid")
                        .HasComment("Редактор");

                    b.Property<Guid?>("IdNext")
                        .HasColumnType("uuid")
                        .HasComment("Id заменяющей записи");

                    b.Property<Guid>("IdSection")
                        .HasColumnType("uuid")
                        .HasComment("Ключ секции");

                    b.Property<DateTimeOffset?>("Obsolete")
                        .HasColumnType("timestamp with time zone")
                        .HasComment("Дата устаревания (например при удалении)");

                    b.Property<string>("Value")
                        .IsRequired()
                        .HasColumnType("jsonb")
                        .HasComment("Значение");

                    b.HasKey("Id");

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

            modelBuilder.Entity("DD.Persistence.Database.Model.DataSaub", b =>
                {
                    b.Property<DateTimeOffset>("Date")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("date");

                    b.Property<double?>("AxialLoad")
                        .HasColumnType("double precision")
                        .HasColumnName("axialLoad");

                    b.Property<double?>("BitDepth")
                        .HasColumnType("double precision")
                        .HasColumnName("bitDepth");

                    b.Property<double?>("BlockPosition")
                        .HasColumnType("double precision")
                        .HasColumnName("blockPosition");

                    b.Property<double?>("BlockSpeed")
                        .HasColumnType("double precision")
                        .HasColumnName("blockSpeed");

                    b.Property<double?>("Flow")
                        .HasColumnType("double precision")
                        .HasColumnName("flow");

                    b.Property<double?>("HookWeight")
                        .HasColumnType("double precision")
                        .HasColumnName("hookWeight");

                    b.Property<int>("IdFeedRegulator")
                        .HasColumnType("integer")
                        .HasColumnName("idFeedRegulator");

                    b.Property<int?>("Mode")
                        .HasColumnType("integer")
                        .HasColumnName("mode");

                    b.Property<double?>("Mse")
                        .HasColumnType("double precision")
                        .HasColumnName("mse");

                    b.Property<short>("MseState")
                        .HasColumnType("smallint")
                        .HasColumnName("mseState");

                    b.Property<double?>("Pressure")
                        .HasColumnType("double precision")
                        .HasColumnName("pressure");

                    b.Property<double?>("Pump0Flow")
                        .HasColumnType("double precision")
                        .HasColumnName("pump0Flow");

                    b.Property<double?>("Pump1Flow")
                        .HasColumnType("double precision")
                        .HasColumnName("pump1Flow");

                    b.Property<double?>("Pump2Flow")
                        .HasColumnType("double precision")
                        .HasColumnName("pump2Flow");

                    b.Property<double?>("RotorSpeed")
                        .HasColumnType("double precision")
                        .HasColumnName("rotorSpeed");

                    b.Property<double?>("RotorTorque")
                        .HasColumnType("double precision")
                        .HasColumnName("rotorTorque");

                    b.Property<string>("User")
                        .HasColumnType("text")
                        .HasColumnName("user");

                    b.Property<double?>("WellDepth")
                        .HasColumnType("double precision")
                        .HasColumnName("wellDepth");

                    b.HasKey("Date");

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

            modelBuilder.Entity("DD.Persistence.Database.Model.Setpoint", b =>
                {
                    b.Property<Guid>("Key")
                        .HasColumnType("uuid")
                        .HasComment("Ключ");

                    b.Property<DateTimeOffset>("Created")
                        .HasColumnType("timestamp with time zone")
                        .HasComment("Дата создания уставки");

                    b.Property<Guid>("IdUser")
                        .HasColumnType("uuid")
                        .HasComment("Id автора последнего изменения");

                    b.Property<object>("Value")
                        .IsRequired()
                        .HasColumnType("jsonb")
                        .HasComment("Значение уставки");

                    b.HasKey("Key", "Created");

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

            modelBuilder.Entity("DD.Persistence.Database.Entity.TechMessage", b =>
                {
                    b.HasOne("DD.Persistence.Database.Entity.DataSourceSystem", "System")
                        .WithMany()
                        .HasForeignKey("SystemId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("System");
                });
#pragma warning restore 612, 618
        }
    }
}