// <auto-generated />
using System;
using Knot.Modules.Conversations.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace Knot.Modules.Conversations.Migrations
{
    [DbContext(typeof(ChatsDbContext))]
    [Migration("20260322191932_InitialConversations")]
    partial class InitialConversations
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasDefaultSchema("chats")
                .HasAnnotation("ProductVersion", "10.0.4")
                .HasAnnotation("Relational:MaxIdentifierLength", 63);

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("Knot.Contracts.Conversations.Domain.Chat", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

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

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

                    b.Property<long>("LastMessageSequenceId")
                        .HasColumnType("bigint");

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

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

                    b.HasKey("Id");

                    b.ToTable("Chats", "chats");
                });

            modelBuilder.Entity("Knot.Contracts.Conversations.Domain.Chat", b =>
                {
                    b.OwnsMany("Knot.Contracts.Conversations.Domain.ChatMember", "Members", b1 =>
                        {
                            b1.Property<Guid>("Id")
                                .ValueGeneratedOnAdd()
                                .HasColumnType("uuid");

                            b1.Property<Guid>("ChatId")
                                .HasColumnType("uuid");

                            b1.Property<bool>("IsMuted")
                                .HasColumnType("boolean");

                            b1.Property<bool>("IsPinned")
                                .HasColumnType("boolean");

                            b1.Property<DateTime>("JoinedAt")
                                .HasColumnType("timestamp with time zone");

                            b1.Property<Guid?>("LastDeliveredMessageId")
                                .HasColumnType("uuid");

                            b1.Property<Guid?>("LastReadMessageId")
                                .HasColumnType("uuid");

                            b1.Property<long>("LastReadSequenceId")
                                .HasColumnType("bigint");

                            b1.Property<string>("Role")
                                .IsRequired()
                                .HasColumnType("text");

                            b1.Property<Guid>("UserId")
                                .HasColumnType("uuid");

                            b1.HasKey("Id");

                            b1.HasIndex("ChatId", "UserId")
                                .IsUnique();

                            b1.ToTable("ChatMembers", "chats");

                            b1.WithOwner()
                                .HasForeignKey("ChatId");
                        });

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