// <auto-generated />
using System;
using System.Collections.Generic;
using DysonNetwork.Messager;
using DysonNetwork.Shared.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using NodaTime;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace DysonNetwork.Messager.Migrations
{
    [DbContext(typeof(AppDatabase))]
    [Migration("20260101140847_InitialMigration")]
    partial class InitialMigration
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "10.0.1")
                .HasAnnotation("Relational:MaxIdentifierLength", 63);

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("DysonNetwork.Shared.Models.SnChatMember", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<Guid>("AccountId")
                        .HasColumnType("uuid")
                        .HasColumnName("account_id");

                    b.Property<Instant?>("BreakUntil")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("break_until");

                    b.Property<Guid>("ChatRoomId")
                        .HasColumnType("uuid")
                        .HasColumnName("chat_room_id");

                    b.Property<Instant>("CreatedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("created_at");

                    b.Property<Instant?>("DeletedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("deleted_at");

                    b.Property<Guid?>("InvitedById")
                        .HasColumnType("uuid")
                        .HasColumnName("invited_by_id");

                    b.Property<Instant?>("JoinedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("joined_at");

                    b.Property<Instant?>("LastReadAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("last_read_at");

                    b.Property<Instant?>("LeaveAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("leave_at");

                    b.Property<string>("Nick")
                        .HasMaxLength(1024)
                        .HasColumnType("character varying(1024)")
                        .HasColumnName("nick");

                    b.Property<int>("Notify")
                        .HasColumnType("integer")
                        .HasColumnName("notify");

                    b.Property<ChatTimeoutCause>("TimeoutCause")
                        .HasColumnType("jsonb")
                        .HasColumnName("timeout_cause");

                    b.Property<Instant?>("TimeoutUntil")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("timeout_until");

                    b.Property<Instant>("UpdatedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("updated_at");

                    b.HasKey("Id")
                        .HasName("pk_chat_members");

                    b.HasAlternateKey("ChatRoomId", "AccountId")
                        .HasName("ak_chat_members_chat_room_id_account_id");

                    b.HasIndex("InvitedById")
                        .HasDatabaseName("ix_chat_members_invited_by_id");

                    b.ToTable("chat_members", (string)null);
                });

            modelBuilder.Entity("DysonNetwork.Shared.Models.SnChatMessage", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<List<SnCloudFileReferenceObject>>("Attachments")
                        .IsRequired()
                        .HasColumnType("jsonb")
                        .HasColumnName("attachments");

                    b.Property<Guid>("ChatRoomId")
                        .HasColumnType("uuid")
                        .HasColumnName("chat_room_id");

                    b.Property<string>("Content")
                        .HasMaxLength(4096)
                        .HasColumnType("character varying(4096)")
                        .HasColumnName("content");

                    b.Property<Instant>("CreatedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("created_at");

                    b.Property<Instant?>("DeletedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("deleted_at");

                    b.Property<Instant?>("EditedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("edited_at");

                    b.Property<Guid?>("ForwardedMessageId")
                        .HasColumnType("uuid")
                        .HasColumnName("forwarded_message_id");

                    b.PrimitiveCollection<string>("MembersMentioned")
                        .HasColumnType("jsonb")
                        .HasColumnName("members_mentioned");

                    b.Property<Dictionary<string, object>>("Meta")
                        .HasColumnType("jsonb")
                        .HasColumnName("meta");

                    b.Property<string>("Nonce")
                        .IsRequired()
                        .HasMaxLength(36)
                        .HasColumnType("character varying(36)")
                        .HasColumnName("nonce");

                    b.Property<Guid?>("RepliedMessageId")
                        .HasColumnType("uuid")
                        .HasColumnName("replied_message_id");

                    b.Property<Guid>("SenderId")
                        .HasColumnType("uuid")
                        .HasColumnName("sender_id");

                    b.Property<string>("Type")
                        .IsRequired()
                        .HasMaxLength(1024)
                        .HasColumnType("character varying(1024)")
                        .HasColumnName("type");

                    b.Property<Instant>("UpdatedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("updated_at");

                    b.HasKey("Id")
                        .HasName("pk_chat_messages");

                    b.HasIndex("ChatRoomId")
                        .HasDatabaseName("ix_chat_messages_chat_room_id");

                    b.HasIndex("ForwardedMessageId")
                        .HasDatabaseName("ix_chat_messages_forwarded_message_id");

                    b.HasIndex("RepliedMessageId")
                        .HasDatabaseName("ix_chat_messages_replied_message_id");

                    b.HasIndex("SenderId")
                        .HasDatabaseName("ix_chat_messages_sender_id");

                    b.ToTable("chat_messages", (string)null);
                });

            modelBuilder.Entity("DysonNetwork.Shared.Models.SnChatReaction", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<int>("Attitude")
                        .HasColumnType("integer")
                        .HasColumnName("attitude");

                    b.Property<Instant>("CreatedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("created_at");

                    b.Property<Instant?>("DeletedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("deleted_at");

                    b.Property<Guid>("MessageId")
                        .HasColumnType("uuid")
                        .HasColumnName("message_id");

                    b.Property<Guid>("SenderId")
                        .HasColumnType("uuid")
                        .HasColumnName("sender_id");

                    b.Property<string>("Symbol")
                        .IsRequired()
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)")
                        .HasColumnName("symbol");

                    b.Property<Instant>("UpdatedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("updated_at");

                    b.HasKey("Id")
                        .HasName("pk_chat_reactions");

                    b.HasIndex("MessageId")
                        .HasDatabaseName("ix_chat_reactions_message_id");

                    b.HasIndex("SenderId")
                        .HasDatabaseName("ix_chat_reactions_sender_id");

                    b.ToTable("chat_reactions", (string)null);
                });

            modelBuilder.Entity("DysonNetwork.Shared.Models.SnChatRoom", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<Guid?>("AccountId")
                        .HasColumnType("uuid")
                        .HasColumnName("account_id");

                    b.Property<SnCloudFileReferenceObject>("Background")
                        .HasColumnType("jsonb")
                        .HasColumnName("background");

                    b.Property<Instant>("CreatedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("created_at");

                    b.Property<Instant?>("DeletedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("deleted_at");

                    b.Property<string>("Description")
                        .HasMaxLength(4096)
                        .HasColumnType("character varying(4096)")
                        .HasColumnName("description");

                    b.Property<bool>("IsCommunity")
                        .HasColumnType("boolean")
                        .HasColumnName("is_community");

                    b.Property<bool>("IsPublic")
                        .HasColumnType("boolean")
                        .HasColumnName("is_public");

                    b.Property<string>("Name")
                        .HasMaxLength(1024)
                        .HasColumnType("character varying(1024)")
                        .HasColumnName("name");

                    b.Property<SnCloudFileReferenceObject>("Picture")
                        .HasColumnType("jsonb")
                        .HasColumnName("picture");

                    b.Property<Guid?>("RealmId")
                        .HasColumnType("uuid")
                        .HasColumnName("realm_id");

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

                    b.Property<Instant>("UpdatedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("updated_at");

                    b.HasKey("Id")
                        .HasName("pk_chat_rooms");

                    b.ToTable("chat_rooms", (string)null);
                });

            modelBuilder.Entity("DysonNetwork.Shared.Models.SnRealtimeCall", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<Instant>("CreatedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("created_at");

                    b.Property<Instant?>("DeletedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("deleted_at");

                    b.Property<Instant?>("EndedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("ended_at");

                    b.Property<string>("ProviderName")
                        .HasColumnType("text")
                        .HasColumnName("provider_name");

                    b.Property<Guid>("RoomId")
                        .HasColumnType("uuid")
                        .HasColumnName("room_id");

                    b.Property<Guid>("SenderId")
                        .HasColumnType("uuid")
                        .HasColumnName("sender_id");

                    b.Property<string>("SessionId")
                        .HasColumnType("text")
                        .HasColumnName("session_id");

                    b.Property<Instant>("UpdatedAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("updated_at");

                    b.Property<string>("UpstreamConfigJson")
                        .HasColumnType("jsonb")
                        .HasColumnName("upstream");

                    b.HasKey("Id")
                        .HasName("pk_chat_realtime_call");

                    b.HasIndex("RoomId")
                        .HasDatabaseName("ix_chat_realtime_call_room_id");

                    b.HasIndex("SenderId")
                        .HasDatabaseName("ix_chat_realtime_call_sender_id");

                    b.ToTable("chat_realtime_call", (string)null);
                });

            modelBuilder.Entity("DysonNetwork.Shared.Models.SnChatMember", b =>
                {
                    b.HasOne("DysonNetwork.Shared.Models.SnChatRoom", "ChatRoom")
                        .WithMany("Members")
                        .HasForeignKey("ChatRoomId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired()
                        .HasConstraintName("fk_chat_members_chat_rooms_chat_room_id");

                    b.HasOne("DysonNetwork.Shared.Models.SnChatMember", "InvitedBy")
                        .WithMany()
                        .HasForeignKey("InvitedById")
                        .HasConstraintName("fk_chat_members_chat_members_invited_by_id");

                    b.Navigation("ChatRoom");

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

            modelBuilder.Entity("DysonNetwork.Shared.Models.SnChatMessage", b =>
                {
                    b.HasOne("DysonNetwork.Shared.Models.SnChatRoom", "ChatRoom")
                        .WithMany()
                        .HasForeignKey("ChatRoomId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired()
                        .HasConstraintName("fk_chat_messages_chat_rooms_chat_room_id");

                    b.HasOne("DysonNetwork.Shared.Models.SnChatMessage", "ForwardedMessage")
                        .WithMany()
                        .HasForeignKey("ForwardedMessageId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .HasConstraintName("fk_chat_messages_chat_messages_forwarded_message_id");

                    b.HasOne("DysonNetwork.Shared.Models.SnChatMessage", "RepliedMessage")
                        .WithMany()
                        .HasForeignKey("RepliedMessageId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .HasConstraintName("fk_chat_messages_chat_messages_replied_message_id");

                    b.HasOne("DysonNetwork.Shared.Models.SnChatMember", "Sender")
                        .WithMany("Messages")
                        .HasForeignKey("SenderId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired()
                        .HasConstraintName("fk_chat_messages_chat_members_sender_id");

                    b.Navigation("ChatRoom");

                    b.Navigation("ForwardedMessage");

                    b.Navigation("RepliedMessage");

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

            modelBuilder.Entity("DysonNetwork.Shared.Models.SnChatReaction", b =>
                {
                    b.HasOne("DysonNetwork.Shared.Models.SnChatMessage", "Message")
                        .WithMany("Reactions")
                        .HasForeignKey("MessageId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired()
                        .HasConstraintName("fk_chat_reactions_chat_messages_message_id");

                    b.HasOne("DysonNetwork.Shared.Models.SnChatMember", "Sender")
                        .WithMany("Reactions")
                        .HasForeignKey("SenderId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired()
                        .HasConstraintName("fk_chat_reactions_chat_members_sender_id");

                    b.Navigation("Message");

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

            modelBuilder.Entity("DysonNetwork.Shared.Models.SnRealtimeCall", b =>
                {
                    b.HasOne("DysonNetwork.Shared.Models.SnChatRoom", "Room")
                        .WithMany()
                        .HasForeignKey("RoomId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired()
                        .HasConstraintName("fk_chat_realtime_call_chat_rooms_room_id");

                    b.HasOne("DysonNetwork.Shared.Models.SnChatMember", "Sender")
                        .WithMany()
                        .HasForeignKey("SenderId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired()
                        .HasConstraintName("fk_chat_realtime_call_chat_members_sender_id");

                    b.Navigation("Room");

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

            modelBuilder.Entity("DysonNetwork.Shared.Models.SnChatMember", b =>
                {
                    b.Navigation("Messages");

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

            modelBuilder.Entity("DysonNetwork.Shared.Models.SnChatMessage", b =>
                {
                    b.Navigation("Reactions");
                });

            modelBuilder.Entity("DysonNetwork.Shared.Models.SnChatRoom", b =>
                {
                    b.Navigation("Members");
                });
#pragma warning restore 612, 618
        }
    }
}
