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

#nullable disable

namespace NexusRMM.Infrastructure.Migrations
{
    [DbContext(typeof(RmmDbContext))]
    partial class RmmDbContextModelSnapshot : ModelSnapshot
    {
        protected override void BuildModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "10.0.5")
                .HasAnnotation("Relational:MaxIdentifierLength", 63);

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("NexusRMM.Core.Models.Agent", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

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

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

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

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

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

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

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

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

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

                    b.PrimitiveCollection<string>("Tags")
                        .IsRequired()
                        .HasColumnType("jsonb");

                    b.HasKey("Id");

                    b.HasIndex("Hostname");

                    b.HasIndex("MacAddress");

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

            modelBuilder.Entity("NexusRMM.Core.Models.AgentMetric", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("bigint");

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

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

                    b.Property<JsonElement>("Metrics")
                        .HasColumnType("jsonb");

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

                    b.HasKey("Id");

                    b.HasIndex("AgentId");

                    b.HasIndex("Timestamp");

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

            modelBuilder.Entity("NexusRMM.Core.Models.Alert", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("bigint");

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

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("AgentId");

                    b.HasIndex("CreatedAt");

                    b.HasIndex("RuleId");

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

            modelBuilder.Entity("NexusRMM.Core.Models.AlertRule", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

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

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

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

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

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

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

                    b.Property<double>("Threshold")
                        .HasColumnType("double precision");

                    b.HasKey("Id");

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

            modelBuilder.Entity("NexusRMM.Core.Models.TaskItem", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

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

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

                    b.Property<JsonElement?>("Payload")
                        .HasColumnType("jsonb");

                    b.Property<JsonElement?>("Result")
                        .HasColumnType("jsonb");

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

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

                    b.HasKey("Id");

                    b.HasIndex("AgentId");

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

            modelBuilder.Entity("NexusRMM.Core.Models.Ticket", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer");

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

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

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

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

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

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

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

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

                    b.HasKey("Id");

                    b.HasIndex("AgentId");

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

            modelBuilder.Entity("NexusRMM.Core.Models.AgentMetric", b =>
                {
                    b.HasOne("NexusRMM.Core.Models.Agent", "Agent")
                        .WithMany("Metrics")
                        .HasForeignKey("AgentId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("NexusRMM.Core.Models.Alert", b =>
                {
                    b.HasOne("NexusRMM.Core.Models.Agent", "Agent")
                        .WithMany("Alerts")
                        .HasForeignKey("AgentId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("NexusRMM.Core.Models.AlertRule", "Rule")
                        .WithMany("Alerts")
                        .HasForeignKey("RuleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Agent");

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

            modelBuilder.Entity("NexusRMM.Core.Models.TaskItem", b =>
                {
                    b.HasOne("NexusRMM.Core.Models.Agent", "Agent")
                        .WithMany("Tasks")
                        .HasForeignKey("AgentId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

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

            modelBuilder.Entity("NexusRMM.Core.Models.Ticket", b =>
                {
                    b.HasOne("NexusRMM.Core.Models.Agent", "Agent")
                        .WithMany("Tickets")
                        .HasForeignKey("AgentId");

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

            modelBuilder.Entity("NexusRMM.Core.Models.Agent", b =>
                {
                    b.Navigation("Alerts");

                    b.Navigation("Metrics");

                    b.Navigation("Tasks");

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

            modelBuilder.Entity("NexusRMM.Core.Models.AlertRule", b =>
                {
                    b.Navigation("Alerts");
                });
#pragma warning restore 612, 618
        }
    }
}
