// import { google } from "googleapis";

// const auth = new google.auth.GoogleAuth({
//   // your credentials to authenticate
//   keyFile: process.cwd() + "/credentials.json",
//   // the actions you are permissed to perform using this API, in this case
//   // all CRUD operations are permissed, check out
//   // [ https://developers.google.com/drive/api/guides/api-specific-auth ]
//   // for more advice on scopes
//   scopes: ["https://www.googleapis.com/auth/drive"],
// });

// const getDriveFiles = async () => {
//   // allows you to use drive API methods e.g. listing files, creating files.
//   const drive = google.drive({ version: "v3", auth });
//   try {
//     const res = await drive.files.list();
//     const files = res.data.files;


//     return files;
//   } catch (error: any) {
//     console.error("Error fetching files:", error.message);
//     return null;
//   }
// };

// async function getDocument() {
//   const docs = google.docs({ version: "v1", auth });
//   const drive = google.drive({ version: "v3", auth });

//   try {
//     const res = await drive.files.get({
//       fileId: "1r8nTVnwlXxQOpCj9u3uwYX58Fo1W3nY_vgxgUUVt-Vk",
//     });
//     const files = res.data;

//     const create = await docs.documents.create()
//     // const files = res.data.files;

//     const update = await docs.documents.batchUpdate({
//       documentId: "1r8nTVnwlXxQOpCj9u3uwYX58Fo1W3nY_vgxgUUVt-Vk",
//       requestBody: {
//         requests: [
//           {
//             replaceAllText: {
//               containsText: { matchCase: false, text: "{{test}}" },
//               replaceText: "Teste Bem Sucedido",
//             },
//           },
//         ],
//       },
//     });

//     return { status: update.status };

//     const response = await docs.documents.get({
//       documentId: "1r8nTVnwlXxQOpCj9u3uwYX58Fo1W3nY_vgxgUUVt-Vk",
//     });
//     const document = response.data;
//     return document;

//     return files;
//   } catch (error: any) {
//     console.error("Error fetching files:", error.message);
//     return null;
//   }
// }

// export default async function test2(req: any, res: any) {
//   // getData().then((data) => {
//   //   res.send(data);
//   // });
//   // res.send({ empty: "" });
//   const response = await getDocument();
//   res.send(response);
// }
