// <auto-generated />
using System;
using System.Text.Json;
using DF.AppUsage.Api.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace DF.AppUsage.Api.Migrations
{
    [DbContext(typeof(AppDbContext))]
    [Migration("20260125115153_AddExternalId")]
    partial class AddExternalId
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "8.0.11")
                .HasAnnotation("Relational:MaxIdentifierLength", 63);

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("DF.AppUsage.Api.Models.AppInsightEntry", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("bigint");

                    NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));

                    b.Property<JsonDocument>("Data")
                        .IsRequired()
                        .HasColumnType("jsonb");

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

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

                    b.Property<DateTime>("RetrievedAt")
                        .HasColumnType("timestamp with time zone");

                    b.Property<DateTime>("Timestamp")
                        .HasColumnType("timestamp with time zone");

                    b.HasKey("Id");

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

                    b.HasIndex("Timestamp", "InsightType");

                    b.ToTable("InsightEntries");
                });
#pragma warning restore 612, 618
        }
    }
}
