"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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NodeSizeMapper = void 0;
const common_1 = require("@nestjs/common");
let NodeSizeMapper = class NodeSizeMapper {
    /**
     * Maps Hetzner ServerType to NodeSizeDto
     */
    mapHetznerServerTypeToDto(serverType) {
        return {
            id: serverType.id.toString(),
            name: serverType.name,
            description: serverType.description,
            cores: serverType.cores,
            memory: serverType.memory,
            disk: serverType.disk,
            storageType: serverType.storage_type,
            cpuType: serverType.cpu_type,
            architecture: serverType.architecture,
            deprecated: serverType.deprecated,
            bareMetal: false,
            managedFirewall: true,
            supportsHourlyBilling: true,
            prices: serverType.prices.map((price) => this.mapPrice(price)),
            locations: serverType.locations?.map((loc) => this.mapLocation(loc)) || [],
        };
    }
    /**
     * Maps Hetzner price data to NodeSizePriceDto
     */
    mapPrice(price) {
        return {
            location: price.location,
            priceHourly: {
                net: price.price_hourly.net,
                gross: price.price_hourly.gross,
            },
            priceMonthly: {
                net: price.price_monthly.net,
                gross: price.price_monthly.gross,
            },
        };
    }
    /**
     * Maps Hetzner location data to NodeSizeLocationDto
     */
    mapLocation(location) {
        return {
            id: location.id,
            name: location.name,
            deprecation: location.deprecation
                ? {
                    unavailable_after: location.deprecation.unavailable_after,
                    announced: location.deprecation.announced,
                }
                : null,
        };
    }
    /**
     * Maps multiple Hetzner ServerTypes to DTOs
     */
    mapHetznerServerTypesToDtos(serverTypes) {
        return serverTypes.map((st) => this.mapHetznerServerTypeToDto(st));
    }
};
exports.NodeSizeMapper = NodeSizeMapper;
exports.NodeSizeMapper = NodeSizeMapper = __decorate([
    (0, common_1.Injectable)()
], NodeSizeMapper);
