import sendResponse from "@backend/components/sendResponse"
import getPlayer from "@lib/backend/components/getPlayer"
import type { Game } from "@prisma/client"
import type { NextApiRequest, NextApiResponse } from "next"

interface Data {
  games: Game[]
}

export default async function data(
  req: NextApiRequest,
  res: NextApiResponse<Data>
) {
  const context = { req, res }

  const { player, tokenDB } = await getPlayer(context)
  const games: any = {}
  return sendResponse(context, {
    message: `Requested data of user: ${player.id} with Access-Token: ${tokenDB.id}`,
    body: { games },
    type: ["debug", "infoCyan"],
  })
}
