/**
 * GET /api/applications/:id/cloud-deploy/status
 *
 * Returns the persisted cloud deployment status DTO for the application.
 */
import { NextResponse } from 'next/server';
import { resolve } from '../../../../../../lib/server-container.js';
import { errorCode, errorMessage } from '../../../../../../lib/error-code.js';
export const dynamic = 'force-dynamic';
export async function GET(_request, { params }) {
    try {
        const { id } = await params;
        const useCase = resolve('GetCloudDeploymentStatusUseCase');
        const dto = await useCase.execute(id);
        return NextResponse.json(dto);
    }
    catch (error) {
        const code = errorCode(error);
        const message = errorMessage(error);
        if (code === 'APPLICATION_NOT_FOUND') {
            return NextResponse.json({ error: message, code }, { status: 404 });
        }
        return NextResponse.json({ error: message }, { status: 500 });
    }
}
