// engine/infrastructure/cost-estimator.ts — Monthly cloud cost estimator (SPEC-171)
import { resolveEnvironment } from './component-mapper.js';
/** Base monthly costs per component kind and environment (USD) */
const BASE_COSTS = {
    rds: { dev: 15, staging: 35, prod: 120 },
    supabase: { dev: 0, staging: 25, prod: 25 },
    redis: { dev: 15, staging: 25, prod: 65 },
    sqs: { dev: 0, staging: 1, prod: 5 },
    s3: { dev: 2, staging: 5, prod: 25 },
    ecs: { dev: 20, staging: 45, prod: 180 },
    lambda: { dev: 0, staging: 2, prod: 15 },
    'railway-service': { dev: 5, staging: 20, prod: 20 },
    'k8s-deployment': { dev: 0, staging: 30, prod: 100 },
    'k8s-service': { dev: 0, staging: 5, prod: 10 },
    'k8s-ingress': { dev: 0, staging: 10, prod: 25 },
    'cdn-cloudfront': { dev: 0, staging: 5, prod: 20 },
    'generic-database': { dev: 10, staging: 25, prod: 80 },
    'generic-cache': { dev: 10, staging: 20, prod: 50 },
    'generic-queue': { dev: 0, staging: 5, prod: 15 },
    'generic-storage': { dev: 2, staging: 5, prod: 20 },
};
const DISCLAIMER = 'Cost estimates are approximate and based on typical AWS/Railway pricing (March 2026). ' +
    'Actual costs depend on usage, region, reserved instances, and negotiated rates. ' +
    'Always verify with your cloud provider pricing calculator.';
/**
 * Attach monthly cost estimates to components and return summary.
 */
export function estimateCosts(components, environment) {
    const env = resolveEnvironment(environment);
    let total = 0;
    const breakdown = [];
    for (const component of components) {
        const costMap = BASE_COSTS[component.kind] ?? { dev: 5, staging: 10, prod: 30 };
        const cost = costMap[env] ?? 0;
        // Mutate in place so the component carries its own estimate
        component.estimatedMonthlyCostUsd = cost;
        total += cost;
        breakdown.push({ component: component.name, monthlyCostUsd: cost });
    }
    return {
        environment: env,
        totalMonthlyCostUsd: total,
        breakdown,
        currency: 'USD',
        disclaimer: DISCLAIMER,
    };
}
//# sourceMappingURL=cost-estimator.js.map