import { NextRequest, NextResponse } from 'next/server';
import { ResultDto } from '@/types/response/common';
import { fetchJson } from '@/lib/utils/server';

// 시장 데이터 프록시 — 전부 익명 GET (지수/ETP/채권/파생/상품/ESG/환율/금리/공시)
export async function GET(request: NextRequest, { params }: { params: Promise<{ path: string[] }> }) {
	const { path } = await params;
	const endpoint = `/api/market/${path.join('/')}`;
	const url = new URL(request.url);
	const res: ResultDto = await fetchJson(`${endpoint}${url.search}`, { method: 'GET' });
	return NextResponse.json(res);
}
