"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.ProviderFirewallDto = exports.ProviderUpdateFirewallRulesDto = exports.CreateFirewallDto = exports.FirewallRuleDto = void 0;
const class_validator_1 = require("class-validator");
const class_transformer_1 = require("class-transformer");
class FirewallRuleDto {
}
exports.FirewallRuleDto = FirewallRuleDto;
__decorate([
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsString)(),
    (0, class_validator_1.Matches)(/^[a-z0-9-]+$/, {
        message: 'Rule ID must be lowercase alphanumeric with hyphens (kebab-case)',
    }),
    __metadata("design:type", String)
], FirewallRuleDto.prototype, "id", void 0);
__decorate([
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], FirewallRuleDto.prototype, "description", void 0);
__decorate([
    (0, class_validator_1.IsIn)(['in', 'out']),
    __metadata("design:type", String)
], FirewallRuleDto.prototype, "direction", void 0);
__decorate([
    (0, class_validator_1.IsIn)(['tcp', 'udp', 'icmp']),
    __metadata("design:type", String)
], FirewallRuleDto.prototype, "protocol", void 0);
__decorate([
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], FirewallRuleDto.prototype, "port", void 0);
__decorate([
    (0, class_validator_1.ValidateIf)((o) => o.direction === 'in'),
    (0, class_validator_1.IsArray)(),
    (0, class_validator_1.ArrayMinSize)(1, {
        message: 'sourceIps is required for inbound rules and must contain at least one IP address (e.g., ["0.0.0.0/0", "::/0"])',
    }),
    (0, class_validator_1.IsString)({ each: true }),
    __metadata("design:type", Array)
], FirewallRuleDto.prototype, "sourceIps", void 0);
__decorate([
    (0, class_validator_1.ValidateIf)((o) => o.direction === 'out'),
    (0, class_validator_1.IsArray)(),
    (0, class_validator_1.ArrayMinSize)(1, {
        message: 'destinationIps is required for outbound rules and must contain at least one IP address (e.g., ["0.0.0.0/0", "::/0"])',
    }),
    (0, class_validator_1.IsString)({ each: true }),
    __metadata("design:type", Array)
], FirewallRuleDto.prototype, "destinationIps", void 0);
class CreateFirewallDto {
}
exports.CreateFirewallDto = CreateFirewallDto;
__decorate([
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateFirewallDto.prototype, "name", void 0);
__decorate([
    (0, class_validator_1.IsArray)(),
    (0, class_validator_1.ValidateNested)({ each: true }),
    (0, class_transformer_1.Type)(() => FirewallRuleDto),
    __metadata("design:type", Array)
], CreateFirewallDto.prototype, "rules", void 0);
__decorate([
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsObject)(),
    __metadata("design:type", Object)
], CreateFirewallDto.prototype, "labels", void 0);
__decorate([
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsArray)(),
    (0, class_validator_1.IsString)({ each: true }),
    __metadata("design:type", Array)
], CreateFirewallDto.prototype, "applyToServerIds", void 0);
__decorate([
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], CreateFirewallDto.prototype, "applyToLabelSelector", void 0);
class ProviderUpdateFirewallRulesDto {
}
exports.ProviderUpdateFirewallRulesDto = ProviderUpdateFirewallRulesDto;
__decorate([
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], ProviderUpdateFirewallRulesDto.prototype, "firewallId", void 0);
__decorate([
    (0, class_validator_1.IsArray)(),
    (0, class_validator_1.ValidateNested)({ each: true }),
    (0, class_transformer_1.Type)(() => FirewallRuleDto),
    __metadata("design:type", Array)
], ProviderUpdateFirewallRulesDto.prototype, "rules", void 0);
class ProviderFirewallDto {
}
exports.ProviderFirewallDto = ProviderFirewallDto;
