import { eq } from 'drizzle-orm';
import { NextResponse } from 'next/server';
import { db } from '@/db/drizzle';
import { client, image, moreProject, project } from '@/db/schema';

// export const GET = async (
//   req: Request,
//   { params }: { params: { id: string } }
// ) => {
//   try {
//     const { id } = params;

//     const projectData = await db.query.project.findFirst({
//       where: eq(project.id, id),
//       with: {
//         client: true,
//         images: true,
//         moreProjects: true,
//       },
//     });

//     if (!projectData) {
//       return NextResponse.json({ error: 'Project not found' }, { status: 404 });
//     }

//     return NextResponse.json(projectData);
//   } catch (error) {
//     console.error('Error fetching project:', error);
//     return NextResponse.json(
//       { error: 'Internal Server Error' },
//       { status: 500 }
//     );
//   }
// };

export const GET = async (
  req: Request,
  { params }: { params: { id: string } }
) => {
  try {
    const { id } = params;
    const rt = await db
    .select(
    

    )
    .from(project)
    
    .where(eq(project.id, id));

    if (rt.length === 0) {
      return NextResponse.json({ error: 'Project not found' }, { status: 404 });
    }

    return NextResponse.json(rt[0]);
  } catch (error) {
    console.error('Error fetching service:', error);
    return NextResponse.json(
      { error: 'Internal Server Error' },
      { status: 500 }
    );
  }
};
