"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RegisterClusterResponseDto = exports.RegisterClusterDto = void 0;
const class_validator_1 = require("class-validator");
const swagger_1 = require("@nestjs/swagger");
const cloud_provider_enum_1 = require("../../../../modules/providers/enums/cloud-provider.enum");
/**
 * DTO for registering an existing cluster (e.g., observability cluster)
 * into the database without creating new infrastructure.
 */
class RegisterClusterDto {
}
exports.RegisterClusterDto = RegisterClusterDto;
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        example: '8c441471-e304-4576-82d7-2878c26ffaf3',
        description: 'CLI-generated cluster UUID. When provided, used as the database primary key ' +
            'so Loki/Prometheus log labels (cluster_id) match the DB ID directly. ' +
            'If omitted, a new UUID is auto-generated.',
    }),
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsUUID)('4'),
    __metadata("design:type", String)
], RegisterClusterDto.prototype, "clusterId", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        example: 'a1b2c3d4-5678-1234-90ab-cdef87654321',
        description: 'CLI-generated node UUID for the master node. When provided, used as the ' +
            'node primary key so Loki log labels (server_id) match the DB ID directly. ' +
            'If omitted, a new UUID is auto-generated.',
    }),
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsUUID)('4'),
    __metadata("design:type", String)
], RegisterClusterDto.prototype, "nodeId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        example: 'observability-cluster-1767092311382',
        minLength: 3,
        maxLength: 63,
        description: 'Cluster name',
    }),
    (0, class_validator_1.IsString)(),
    (0, class_validator_1.MinLength)(3),
    (0, class_validator_1.MaxLength)(63),
    __metadata("design:type", String)
], RegisterClusterDto.prototype, "name", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        enum: cloud_provider_enum_1.CloudProvider,
        example: cloud_provider_enum_1.CloudProvider.HETZNER,
        description: 'Cloud provider',
    }),
    (0, class_validator_1.IsEnum)(cloud_provider_enum_1.CloudProvider),
    __metadata("design:type", String)
], RegisterClusterDto.prototype, "provider", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        example: 'nbg1',
        description: 'Region/location code',
    }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], RegisterClusterDto.prototype, "region", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        example: 'cx22',
        description: 'Node size/type',
    }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], RegisterClusterDto.prototype, "nodeSize", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        example: '116.203.40.159',
        description: 'Master node IP address',
    }),
    (0, class_validator_1.IsString)(),
    (0, class_validator_1.IsIP)(4),
    __metadata("design:type", String)
], RegisterClusterDto.prototype, "masterIpAddress", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        example: '3+dAcRtOyMHPahOKvpk...',
        description: 'Encrypted K3s token (already encrypted)',
    }),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], RegisterClusterDto.prototype, "k3sTokenEncrypted", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        example: 'v1.35.4+k3s1',
        description: 'K3s version',
    }),
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], RegisterClusterDto.prototype, "k3sVersion", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        example: 'ubuntu-24.04',
        description: 'OS image',
    }),
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], RegisterClusterDto.prototype, "image", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        example: {
            isObservabilityCluster: true,
            purpose: 'observability',
        },
        description: 'Cluster metadata.',
    }),
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsObject)(),
    __metadata("design:type", Object)
], RegisterClusterDto.prototype, "metadata", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        example: ['ssh-key-id-1'],
        description: 'SSH key IDs',
    }),
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsArray)(),
    (0, class_validator_1.IsString)({ each: true }),
    __metadata("design:type", Array)
], RegisterClusterDto.prototype, "sshKeyIds", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        example: 'encrypted-kubeconfig-data...',
        description: 'Encrypted kubeconfig (if not provided, will be fetched from master node)',
    }),
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], RegisterClusterDto.prototype, "kubeconfigEncrypted", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        example: '12345678',
        description: 'Provider resource ID for master node (if not provided, will be queried from provider API)',
    }),
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], RegisterClusterDto.prototype, "masterProviderResourceId", void 0);
/**
 * Response DTO for cluster registration
 */
class RegisterClusterResponseDto {
}
exports.RegisterClusterResponseDto = RegisterClusterResponseDto;
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Cluster ID',
        example: 'b9e2d4f1-5678-1234-90ab-cdef87654321',
    }),
    __metadata("design:type", String)
], RegisterClusterResponseDto.prototype, "cluster_id", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Master node ID (use this for metrics API)',
        example: 'a1b2c3d4-5678-1234-90ab-cdef87654321',
    }),
    __metadata("design:type", String)
], RegisterClusterResponseDto.prototype, "node_id", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Metrics API endpoint for this node',
        example: '/api/v1/servers/a1b2c3d4-5678-1234-90ab-cdef87654321/metrics',
    }),
    __metadata("design:type", String)
], RegisterClusterResponseDto.prototype, "metrics_endpoint", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Registration status',
        example: 'registered',
    }),
    __metadata("design:type", String)
], RegisterClusterResponseDto.prototype, "status", void 0);
