"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.ProviderCredentialsDto = void 0;
const swagger_1 = require("@nestjs/swagger");
const class_validator_1 = require("class-validator");
const cloud_provider_enum_1 = require("../../providers/enums/cloud-provider.enum");
const credentials_entity_1 = require("../entities/credentials.entity");
class ProviderCredentialsDto {
}
exports.ProviderCredentialsDto = ProviderCredentialsDto;
__decorate([
    (0, swagger_1.ApiProperty)({ enum: cloud_provider_enum_1.CloudProvider }),
    (0, class_validator_1.IsEnum)(cloud_provider_enum_1.CloudProvider),
    __metadata("design:type", String)
], ProviderCredentialsDto.prototype, "provider", void 0);
__decorate([
    (0, swagger_1.ApiProperty)({
        enum: credentials_entity_1.CredentialType,
        description: 'Type of credentials to validate',
    }),
    (0, class_validator_1.IsEnum)(credentials_entity_1.CredentialType),
    __metadata("design:type", String)
], ProviderCredentialsDto.prototype, "type", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'API token — required when type is api_key',
    }),
    (0, class_validator_1.ValidateIf)((o) => o.type === credentials_entity_1.CredentialType.API_KEY),
    (0, class_validator_1.IsNotEmpty)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], ProviderCredentialsDto.prototype, "apiKey", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Access Key ID — required when type is access_key_secret (e.g. Scaleway Access Key ID)',
    }),
    (0, class_validator_1.ValidateIf)((o) => o.type === credentials_entity_1.CredentialType.ACCESS_KEY_SECRET),
    (0, class_validator_1.IsNotEmpty)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], ProviderCredentialsDto.prototype, "accessKey", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Secret Key — required when type is access_key_secret (e.g. Scaleway Secret Key)',
    }),
    (0, class_validator_1.ValidateIf)((o) => o.type === credentials_entity_1.CredentialType.ACCESS_KEY_SECRET),
    (0, class_validator_1.IsNotEmpty)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], ProviderCredentialsDto.prototype, "secretKey", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Optional expiry date of the key. Cannot be inferred from the key itself — ' +
            'provide it if the key has an expiry set in the provider console. ISO 8601 format.',
        example: '2027-03-14T00:00:00.000Z',
    }),
    (0, class_validator_1.IsOptional)(),
    (0, class_validator_1.IsDateString)(),
    __metadata("design:type", String)
], ProviderCredentialsDto.prototype, "expiresAt", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Username — required when type is user_password',
    }),
    (0, class_validator_1.ValidateIf)((o) => o.type === credentials_entity_1.CredentialType.USER_PASSWORD),
    (0, class_validator_1.IsNotEmpty)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], ProviderCredentialsDto.prototype, "username", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Password — required when type is user_password',
    }),
    (0, class_validator_1.ValidateIf)((o) => o.type === credentials_entity_1.CredentialType.USER_PASSWORD),
    (0, class_validator_1.IsNotEmpty)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], ProviderCredentialsDto.prototype, "password", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Client ID — required when type is user_password',
    }),
    (0, class_validator_1.ValidateIf)((o) => o.type === credentials_entity_1.CredentialType.USER_PASSWORD),
    (0, class_validator_1.IsNotEmpty)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], ProviderCredentialsDto.prototype, "clientId", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Client Secret — required when type is user_password',
    }),
    (0, class_validator_1.ValidateIf)((o) => o.type === credentials_entity_1.CredentialType.USER_PASSWORD),
    (0, class_validator_1.IsNotEmpty)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], ProviderCredentialsDto.prototype, "clientSecret", void 0);
__decorate([
    (0, swagger_1.ApiPropertyOptional)({
        description: 'Bearer token — required when type is bearer_token',
    }),
    (0, class_validator_1.ValidateIf)((o) => o.type === credentials_entity_1.CredentialType.BEARER_TOKEN),
    (0, class_validator_1.IsNotEmpty)(),
    (0, class_validator_1.IsString)(),
    __metadata("design:type", String)
], ProviderCredentialsDto.prototype, "bearerToken", void 0);
