"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.ListFirewallsQueryDto = exports.ReconciliationStatusDto = exports.FirewallResponseDto = exports.UpdateFirewallRulesDto = exports.CreateClusterFirewallDto = exports.FirewallClusterInfoDto = exports.FirewallNodeInfoDto = exports.FirewallCoverageStatus = void 0;
const class_validator_1 = require("class-validator");
const class_transformer_1 = require("class-transformer");
const swagger_1 = require("@nestjs/swagger");
const firewall_dto_1 = require("../../../providers/dto/firewall.dto");
const cluster_firewall_entity_1 = require("../entities/cluster-firewall.entity");
const cluster_entity_1 = require("../../clusters/entities/cluster.entity");
const cluster_node_entity_1 = require("../../clusters/entities/cluster-node.entity");
var FirewallCoverageStatus;
(function (FirewallCoverageStatus) {
    FirewallCoverageStatus["FULL"] = "FULL";
    FirewallCoverageStatus["PARTIAL"] = "PARTIAL";
    FirewallCoverageStatus["ORPHANED"] = "ORPHANED";
    FirewallCoverageStatus["UNKNOWN"] = "UNKNOWN";
})(FirewallCoverageStatus || (exports.FirewallCoverageStatus = FirewallCoverageStatus = {}));
class FirewallNodeInfoDto {
}
exports.FirewallNodeInfoDto = FirewallNodeInfoDto;
__decorate([
    (0, swagger_1.ApiProperty)({ description: 'Cluster node ID' }),
    __metadata("design:type", String)
], FirewallNodeInfoDto.prototype, "nodeId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: 'Server name' }),
    __metadata("design:type", String)
], FirewallNodeInfoDto.prototype, "serverName", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: 'Node type', enum: cluster_node_entity_1.NodeType }),
    __metadata("design:type", String)
], FirewallNodeInfoDto.prototype, "nodeType", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: 'Node status', enum: cluster_node_entity_1.NodeStatus }),
    __metadata("design:type", String)
], FirewallNodeInfoDto.prototype, "status", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({ description: 'IP address of the node' }),
    __metadata("design:type", String)
], FirewallNodeInfoDto.prototype, "ipAddress", void 0);
class FirewallClusterInfoDto {
}
exports.FirewallClusterInfoDto = FirewallClusterInfoDto;
__decorate([
    (0, swagger_1.ApiProperty)({ description: 'Cluster name' }),
    __metadata("design:type", String)
], FirewallClusterInfoDto.prototype, "clusterName", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: 'Cluster status', enum: cluster_entity_1.ClusterStatus }),
    __metadata("design:type", String)
], FirewallClusterInfoDto.prototype, "clusterStatus", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: 'Total number of cluster nodes' }),
    __metadata("design:type", Number)
], FirewallClusterInfoDto.prototype, "totalNodes", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: 'Number of nodes in READY status' }),
    __metadata("design:type", Number)
], FirewallClusterInfoDto.prototype, "readyNodes", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: 'Cluster nodes', type: [FirewallNodeInfoDto] }),
    __metadata("design:type", Array)
], FirewallClusterInfoDto.prototype, "nodes", void 0);
class CreateClusterFirewallDto {
}
exports.CreateClusterFirewallDto = CreateClusterFirewallDto;
__decorate([
    (0, swagger_1.ApiProperty)({ description: 'Cluster ID' }),
    (0, class_validator_1.IsUUID)(),
    __metadata("design:type", String)
], CreateClusterFirewallDto.prototype, "clusterId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Desired firewall rules',
        type: [firewall_dto_1.FirewallRuleDto],
        default: [],
    }),
    (0, class_validator_1.IsArray)(),
    (0, class_validator_1.ValidateNested)({ each: true }),
    (0, class_transformer_1.Type)(() => firewall_dto_1.FirewallRuleDto),
    __metadata("design:type", Array)
], CreateClusterFirewallDto.prototype, "desiredRules", void 0);
class UpdateFirewallRulesDto {
}
exports.UpdateFirewallRulesDto = UpdateFirewallRulesDto;
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Complete desired firewall rules (full replacement)',
        type: [firewall_dto_1.FirewallRuleDto],
    }),
    (0, class_validator_1.IsArray)(),
    (0, class_validator_1.ValidateNested)({ each: true }),
    (0, class_transformer_1.Type)(() => firewall_dto_1.FirewallRuleDto),
    __metadata("design:type", Array)
], UpdateFirewallRulesDto.prototype, "desiredRules", void 0);
class FirewallResponseDto {
    constructor(partial) {
        Object.assign(this, partial);
    }
}
exports.FirewallResponseDto = FirewallResponseDto;
__decorate([
    (0, swagger_1.ApiProperty)({ description: 'Firewall ID' }),
    __metadata("design:type", String)
], FirewallResponseDto.prototype, "id", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: 'Cluster ID' }),
    __metadata("design:type", String)
], FirewallResponseDto.prototype, "clusterId", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Provider firewall ID (e.g., Hetzner firewall ID)',
    }),
    __metadata("design:type", String)
], FirewallResponseDto.prototype, "providerFirewallId", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Desired firewall rules',
        type: [firewall_dto_1.FirewallRuleDto],
    }),
    __metadata("design:type", Array)
], FirewallResponseDto.prototype, "desiredRules", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Last successfully applied rules',
        type: [firewall_dto_1.FirewallRuleDto],
    }),
    __metadata("design:type", Array)
], FirewallResponseDto.prototype, "lastAppliedRules", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({ description: 'Canonical hash of desired rules' }),
    __metadata("design:type", String)
], FirewallResponseDto.prototype, "desiredHash", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({ description: 'Hash of last applied rules' }),
    __metadata("design:type", String)
], FirewallResponseDto.prototype, "lastAppliedHash", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Reconciliation status',
        enum: cluster_firewall_entity_1.ReconciliationStatus,
    }),
    __metadata("design:type", String)
], FirewallResponseDto.prototype, "reconciliationStatus", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: 'Whether firewall has drift from desired state' }),
    __metadata("design:type", Boolean)
], FirewallResponseDto.prototype, "hasDrift", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({ description: 'Last reconciliation timestamp' }),
    __metadata("design:type", Date)
], FirewallResponseDto.prototype, "lastReconciliationAt", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Error message if reconciliation failed',
    }),
    __metadata("design:type", String)
], FirewallResponseDto.prototype, "errorMessage", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({ description: 'Additional metadata' }),
    __metadata("design:type", Object)
], FirewallResponseDto.prototype, "metadata", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Firewall coverage status based on cluster node health',
        enum: FirewallCoverageStatus,
    }),
    __metadata("design:type", String)
], FirewallResponseDto.prototype, "coverageStatus", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Cluster node information for coverage assessment',
        type: FirewallClusterInfoDto,
    }),
    __metadata("design:type", FirewallClusterInfoDto)
], FirewallResponseDto.prototype, "clusterInfo", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: 'Creation timestamp' }),
    __metadata("design:type", Date)
], FirewallResponseDto.prototype, "createdAt", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: 'Last update timestamp' }),
    __metadata("design:type", Date)
], FirewallResponseDto.prototype, "updatedAt", void 0);
class ReconciliationStatusDto {
}
exports.ReconciliationStatusDto = ReconciliationStatusDto;
__decorate([
    (0, swagger_1.ApiProperty)({
        description: 'Current reconciliation status',
        enum: cluster_firewall_entity_1.ReconciliationStatus,
    }),
    (0, class_validator_1.IsEnum)(cluster_firewall_entity_1.ReconciliationStatus),
    __metadata("design:type", String)
], ReconciliationStatusDto.prototype, "status", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({ description: 'Whether firewall has drift from desired state' }),
    (0, class_validator_1.IsBoolean)(),
    __metadata("design:type", Boolean)
], ReconciliationStatusDto.prototype, "hasDrift", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({ description: 'Last reconciliation timestamp' }),
    (0, class_validator_1.IsOptional)(),
    __metadata("design:type", Date)
], ReconciliationStatusDto.prototype, "lastReconciliationAt", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Error message if reconciliation failed',
    }),
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], ReconciliationStatusDto.prototype, "errorMessage", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({ description: 'Desired rules hash' }),
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], ReconciliationStatusDto.prototype, "desiredHash", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({ description: 'Last applied rules hash' }),
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], ReconciliationStatusDto.prototype, "lastAppliedHash", void 0);
class ListFirewallsQueryDto {
}
exports.ListFirewallsQueryDto = ListFirewallsQueryDto;
__decorate([
    (0, swagger_1.ApiPropertyOptional)({ description: 'Filter by cluster ID' }),
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsUUID)(),
    __metadata("design:type", String)
], ListFirewallsQueryDto.prototype, "clusterId", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Filter by reconciliation status',
        enum: cluster_firewall_entity_1.ReconciliationStatus,
    }),
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsEnum)(cluster_firewall_entity_1.ReconciliationStatus),
    __metadata("design:type", String)
], ListFirewallsQueryDto.prototype, "status", void 0);
