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

#nullable disable

namespace ColaFlow.Modules.Mcp.Infrastructure.Persistence.Migrations
{
    [DbContext(typeof(McpDbContext))]
    partial class McpDbContextModelSnapshot : ModelSnapshot
    {
        protected override void BuildModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasDefaultSchema("mcp")
                .HasAnnotation("ProductVersion", "9.0.10")
                .HasAnnotation("Relational:MaxIdentifierLength", 63);

            NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);

            modelBuilder.Entity("ColaFlow.Modules.Mcp.Domain.Entities.McpApiKey", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid");

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

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

                    b.Property<DateTime>("ExpiresAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("expires_at");

                    b.Property<string>("IpWhitelist")
                        .HasColumnType("jsonb")
                        .HasColumnName("ip_whitelist");

                    b.Property<string>("KeyHash")
                        .IsRequired()
                        .HasMaxLength(64)
                        .HasColumnType("character varying(64)")
                        .HasColumnName("key_hash");

                    b.Property<string>("KeyPrefix")
                        .IsRequired()
                        .HasMaxLength(16)
                        .HasColumnType("character varying(16)")
                        .HasColumnName("key_prefix");

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

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

                    b.Property<string>("Permissions")
                        .IsRequired()
                        .HasColumnType("jsonb")
                        .HasColumnName("permissions");

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

                    b.Property<Guid?>("RevokedBy")
                        .HasColumnType("uuid")
                        .HasColumnName("revoked_by");

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

                    b.Property<Guid>("TenantId")
                        .HasColumnType("uuid")
                        .HasColumnName("tenant_id");

                    b.Property<long>("UsageCount")
                        .HasColumnType("bigint")
                        .HasColumnName("usage_count");

                    b.Property<Guid>("UserId")
                        .HasColumnType("uuid")
                        .HasColumnName("user_id");

                    b.HasKey("Id");

                    b.HasIndex("ExpiresAt")
                        .HasDatabaseName("ix_mcp_api_keys_expires_at");

                    b.HasIndex("KeyPrefix")
                        .IsUnique()
                        .HasDatabaseName("ix_mcp_api_keys_key_prefix");

                    b.HasIndex("Status")
                        .HasDatabaseName("ix_mcp_api_keys_status");

                    b.HasIndex("TenantId")
                        .HasDatabaseName("ix_mcp_api_keys_tenant_id");

                    b.HasIndex("TenantId", "UserId")
                        .HasDatabaseName("ix_mcp_api_keys_tenant_user");

                    b.ToTable("mcp_api_keys", "mcp");
                });

            modelBuilder.Entity("ColaFlow.Modules.Mcp.Domain.Entities.PendingChange", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<Guid>("ApiKeyId")
                        .HasColumnType("uuid")
                        .HasColumnName("api_key_id");

                    b.Property<string>("ApplicationResult")
                        .HasMaxLength(2000)
                        .HasColumnType("character varying(2000)")
                        .HasColumnName("application_result");

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

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

                    b.Property<Guid?>("ApprovedBy")
                        .HasColumnType("uuid")
                        .HasColumnName("approved_by");

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

                    b.Property<string>("Diff")
                        .IsRequired()
                        .HasColumnType("jsonb")
                        .HasColumnName("diff");

                    b.Property<DateTime>("ExpiresAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("expires_at");

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

                    b.Property<Guid?>("RejectedBy")
                        .HasColumnType("uuid")
                        .HasColumnName("rejected_by");

                    b.Property<string>("RejectionReason")
                        .HasMaxLength(1000)
                        .HasColumnType("character varying(1000)")
                        .HasColumnName("rejection_reason");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)")
                        .HasColumnName("status");

                    b.Property<Guid>("TenantId")
                        .HasColumnType("uuid")
                        .HasColumnName("tenant_id");

                    b.Property<string>("ToolName")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)")
                        .HasColumnName("tool_name");

                    b.HasKey("Id");

                    b.HasIndex("ApiKeyId")
                        .HasDatabaseName("ix_pending_changes_api_key_id");

                    b.HasIndex("CreatedAt")
                        .HasDatabaseName("ix_pending_changes_created_at");

                    b.HasIndex("ExpiresAt")
                        .HasDatabaseName("ix_pending_changes_expires_at");

                    b.HasIndex("Status")
                        .HasDatabaseName("ix_pending_changes_status");

                    b.HasIndex("TenantId")
                        .HasDatabaseName("ix_pending_changes_tenant_id");

                    b.HasIndex("TenantId", "Status")
                        .HasDatabaseName("ix_pending_changes_tenant_status");

                    b.ToTable("pending_changes", "mcp");
                });

            modelBuilder.Entity("ColaFlow.Modules.Mcp.Domain.Entities.TaskLock", b =>
                {
                    b.Property<Guid>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("uuid")
                        .HasColumnName("id");

                    b.Property<DateTime>("AcquiredAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("acquired_at");

                    b.Property<DateTime>("ExpiresAt")
                        .HasColumnType("timestamp with time zone")
                        .HasColumnName("expires_at");

                    b.Property<Guid>("LockHolderId")
                        .HasColumnType("uuid")
                        .HasColumnName("lock_holder_id");

                    b.Property<string>("LockHolderName")
                        .HasMaxLength(500)
                        .HasColumnType("character varying(500)")
                        .HasColumnName("lock_holder_name");

                    b.Property<string>("LockHolderType")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)")
                        .HasColumnName("lock_holder_type");

                    b.Property<string>("Purpose")
                        .HasMaxLength(1000)
                        .HasColumnType("character varying(1000)")
                        .HasColumnName("purpose");

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

                    b.Property<Guid>("ResourceId")
                        .HasColumnType("uuid")
                        .HasColumnName("resource_id");

                    b.Property<string>("ResourceType")
                        .IsRequired()
                        .HasMaxLength(200)
                        .HasColumnType("character varying(200)")
                        .HasColumnName("resource_type");

                    b.Property<string>("Status")
                        .IsRequired()
                        .HasMaxLength(50)
                        .HasColumnType("character varying(50)")
                        .HasColumnName("status");

                    b.Property<Guid>("TenantId")
                        .HasColumnType("uuid")
                        .HasColumnName("tenant_id");

                    b.HasKey("Id");

                    b.HasIndex("ExpiresAt")
                        .HasDatabaseName("ix_task_locks_expires_at");

                    b.HasIndex("LockHolderId")
                        .HasDatabaseName("ix_task_locks_lock_holder_id");

                    b.HasIndex("Status")
                        .HasDatabaseName("ix_task_locks_status");

                    b.HasIndex("TenantId", "ResourceType", "ResourceId")
                        .IsUnique()
                        .HasDatabaseName("ix_task_locks_resource");

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