using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Nexus.Api.Data.Migrations
{
    /// <inheritdoc />
    public partial class AddOpenClawConnectionProfile : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "OpenClawConnectionProfiles",
                columns: table => new
                {
                    ProfileId = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    Endpoint = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: false),
                    DiscoverySource = table.Column<string>(type: "character varying(80)", maxLength: 80, nullable: false),
                    RequiredVersion = table.Column<string>(type: "character varying(120)", maxLength: 120, nullable: true),
                    TlsCertificateFingerprint = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
                    AdoptionState = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
                    ManagementEnabled = table.Column<bool>(type: "boolean", nullable: false),
                    CapabilityHash = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: true),
                    DeviceId = table.Column<string>(type: "character varying(240)", maxLength: 240, nullable: true),
                    Revision = table.Column<int>(type: "integer", nullable: false),
                    CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    UpdatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    LastProbedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    LastVerifiedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    AdoptedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OpenClawConnectionProfiles", x => x.ProfileId);
                    table.CheckConstraint("CK_OpenClawConnectionProfiles_Primary", "\"ProfileId\" = 'primary'");
                });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "OpenClawConnectionProfiles");
        }
    }
}
