const { onRequest } = require("firebase-functions/v2/https");


const jsonData = {
  "P00000001": [
    {
      "casestudy lesson id": "FKJDDVZX99JV",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=2qyCk5RN9LE",
      "thumbnail": "https://img.youtube.com/vi/2qyCk5RN9LE/maxresdefault.jpg"
    }
  ],
  "P00000002": [
    {
      "casestudy lesson id": "ET2OAPCSJ51A",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=wUrABUiSydk&list=PL2gjxcSd5oFalcbPN3_RyaonZcmAGT55c",
      "thumbnail": "https://img.youtube.com/vi/wUrABUiSydk/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "QNR5NHDGDS2R",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=0BhrT0JuubE&list=PL2gjxcSd5oFalcbPN3_RyaonZcmAGT55c&index=2",
      "thumbnail": "https://img.youtube.com/vi/0BhrT0JuubE/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "QGZ6KKERGFYQ",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=_11TpUDLjfs&list=PL2gjxcSd5oFalcbPN3_RyaonZcmAGT55c&index=5",
      "thumbnail": "https://img.youtube.com/vi/_11TpUDLjfs/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "FZGXOUWSLOFF",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=AGr2t0LCg8k&list=PL2gjxcSd5oFalcbPN3_RyaonZcmAGT55c&index=3",
      "thumbnail": "https://img.youtube.com/vi/AGr2t0LCg8k/maxresdefault.jpg"
    }
  ],
  "P00000003": [
    {
      "casestudy lesson id": "JROEBRBFP4Q8",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=tgUocrkP8Es&list=PLv6KfiLx9P_1uHbOn0lNz06ZsXFRls893",
      "thumbnail": "https://img.youtube.com/vi/tgUocrkP8Es/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "ENHV51O8R2P1",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=F5XLuFlhINU&list=PLv6KfiLx9P_1uHbOn0lNz06ZsXFRls893&index=2",
      "thumbnail": "https://img.youtube.com/vi/F5XLuFlhINU/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "8XM38YEW2S06",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=pJ_X7yPI7Ow&list=PLv6KfiLx9P_1uHbOn0lNz06ZsXFRls893&index=3",
      "thumbnail": "https://img.youtube.com/vi/pJ_X7yPI7Ow/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "DZ0DA19PB1ZN",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=UaJFeOPtEx8&list=PLv6KfiLx9P_1uHbOn0lNz06ZsXFRls893&index=4",
      "thumbnail": "https://img.youtube.com/vi/UaJFeOPtEx8/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "KWGQBQZ6L38I",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=LXsFOrgbg_o&list=PLv6KfiLx9P_0uFZ_xpwutLxndmeRmDYgD",
      "thumbnail": "https://img.youtube.com/vi/LXsFOrgbg_o/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "BYHTDB08PESR",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=jjm2Aabb2EE&list=PLv6KfiLx9P_0uFZ_xpwutLxndmeRmDYgD&index=2",
      "thumbnail": "https://img.youtube.com/vi/jjm2Aabb2EE/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "C1U44MJI2I5Z",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=alqHjfw_HtM&list=PLv6KfiLx9P_0uFZ_xpwutLxndmeRmDYgD&index=3",
      "thumbnail": "https://img.youtube.com/vi/alqHjfw_HtM/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "WCG02821S3HT",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=089Oo6tKCmE&list=PLv6KfiLx9P_0uFZ_xpwutLxndmeRmDYgD&index=4",
      "thumbnail": "https://img.youtube.com/vi/089Oo6tKCmE/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "W2QGCL0RYFAI",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=1KKXDBzGafo&list=PL4TBSI7_RtBbbWV9Lf1cVXvxg9ipktt3s",
      "thumbnail": "https://img.youtube.com/vi/1KKXDBzGafo/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "SC9SRIAH0CFI",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=5K4qJnNuaP8&list=PL4TBSI7_RtBbbWV9Lf1cVXvxg9ipktt3s&index=2",
      "thumbnail": "https://img.youtube.com/vi/5K4qJnNuaP8/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "4GON1UDTRMLS",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=Akn397pbyIo&list=PL4TBSI7_RtBbbWV9Lf1cVXvxg9ipktt3s&index=3",
      "thumbnail": "https://img.youtube.com/vi/Akn397pbyIo/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "GBLVZHX7TDJ4",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=GTt18ZV31QE&list=PL4TBSI7_RtBbbWV9Lf1cVXvxg9ipktt3s&index=4",
      "thumbnail": "https://img.youtube.com/vi/GTt18ZV31QE/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "HVJ2MIY116Q8",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=PxPzNdrqhX4&list=PL4TBSI7_RtBbbWV9Lf1cVXvxg9ipktt3s&index=5",
      "thumbnail": "https://img.youtube.com/vi/PxPzNdrqhX4/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "IQBSFQ4TQ5QD",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=lR3UUbQsDgA&list=PLV7hU9BBDbaTXgM6bJz2d2vdazJe6MT7H",
      "thumbnail": "https://img.youtube.com/vi/lR3UUbQsDgA/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "ZTGN1NCSKBES",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=69u48Ghc6Ss&list=PLV7hU9BBDbaTXgM6bJz2d2vdazJe6MT7H&index=2",
      "thumbnail": "https://img.youtube.com/vi/69u48Ghc6Ss/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "DVHCZKRJ4RDV",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=AIPcgBOSjM0&list=PLV7hU9BBDbaTXgM6bJz2d2vdazJe6MT7H&index=3",
      "thumbnail": "https://img.youtube.com/vi/AIPcgBOSjM0/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "ZO1FYPQCLO6S",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=hhj2GWKDe-A&list=PLV7hU9BBDbaTXgM6bJz2d2vdazJe6MT7H&index=4",
      "thumbnail": "https://img.youtube.com/vi/hhj2GWKDe-A/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "RC4C7O97HE5Z",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=se9eO9ZcE5Q&list=PLV7hU9BBDbaTXgM6bJz2d2vdazJe6MT7H&index=5",
      "thumbnail": "https://img.youtube.com/vi/se9eO9ZcE5Q/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "CWEDI9YY2XZ0",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=sSgB2zr7Nm0&list=PLV7hU9BBDbaTJM6f5WHLJkHOZxJthtVJV",
      "thumbnail": "https://img.youtube.com/vi/sSgB2zr7Nm0/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "WUWSUWN3XY14",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=0iCz7LXjOkY&list=PLV7hU9BBDbaTJM6f5WHLJkHOZxJthtVJV&index=2",
      "thumbnail": "https://img.youtube.com/vi/0iCz7LXjOkY/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "7343601RUFFE",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=LNbDHGZR1Zk&list=PLV7hU9BBDbaTJM6f5WHLJkHOZxJthtVJV&index=3",
      "thumbnail": "https://img.youtube.com/vi/LNbDHGZR1Zk/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "DEJV2F2PN8U4",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=4qCfvoQi758&list=PLV7hU9BBDbaTJM6f5WHLJkHOZxJthtVJV&index=4",
      "thumbnail": "https://img.youtube.com/vi/4qCfvoQi758/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "P5LI77JGHPBM",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=kL8TGz_kM8U&list=PLV7hU9BBDbaTJM6f5WHLJkHOZxJthtVJV&index=5",
      "thumbnail": "https://img.youtube.com/vi/kL8TGz_kM8U/maxresdefault.jpg"
    }
  ], "P00000004": [
    {
      "casestudy lesson id": "P6WMFVVE1JHN",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=5PNotJrwkYY&list=PLWYr0cX0QTLCzRlSioyNG90GgvblR33j7",
      "thumbnail": "https://img.youtube.com/vi/5PNotJrwkYY/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "AAWW9UG1SKG7",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=IuDqKgGsEA4&list=PLWYr0cX0QTLCzRlSioyNG90GgvblR33j7&index=2",
      "thumbnail": "https://img.youtube.com/vi/IuDqKgGsEA4/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "FA6LVSMOWRZ8",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=pfFSyoduDe4&list=PLWYr0cX0QTLCzRlSioyNG90GgvblR33j7&index=3",
      "thumbnail": "https://img.youtube.com/vi/pfFSyoduDe4/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "VQHSSYSUOJ2W",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=jj5QK7gcJTI&list=PLWYr0cX0QTLCzRlSioyNG90GgvblR33j7&index=4",
      "thumbnail": "https://img.youtube.com/vi/jj5QK7gcJTI/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "TWX2RJH4EWXL",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=U15Eqg_kDCU&list=PLWYr0cX0QTLCzRlSioyNG90GgvblR33j7&index=5",
      "thumbnail": "https://img.youtube.com/vi/U15Eqg_kDCU/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "89BWM83JDQ2Z",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=ea4J80ybzqY&list=PLWYr0cX0QTLCzRlSioyNG90GgvblR33j7&index=6",
      "thumbnail": "https://img.youtube.com/vi/ea4J80ybzqY/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "IGVK3F3K09ME",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=yFXHull0s0I&list=PLWYr0cX0QTLCzRlSioyNG90GgvblR33j7&index=7",
      "thumbnail": "https://img.youtube.com/vi/yFXHull0s0I/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "4IZW54RZW844",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=N-xuqy6x1Bw&list=PLgGbWId6zgaXt4qt5CCLlZRTbyWsQKAPx",
      "thumbnail": "https://img.youtube.com/vi/N-xuqy6x1Bw/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "5GZGNW3FD7CT",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=HvkmJ3Ec-hU&list=PLgGbWId6zgaXt4qt5CCLlZRTbyWsQKAPx&index=2",
      "thumbnail": "https://img.youtube.com/vi/HvkmJ3Ec-hU/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "TSZ06APM2FL5",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=BB6HiXvtcMQ&list=PLgGbWId6zgaXt4qt5CCLlZRTbyWsQKAPx&index=3",
      "thumbnail": "https://img.youtube.com/vi/BB6HiXvtcMQ/maxresdefault.jpg"
    }
  ], "P00000005": [
    {
      "casestudy lesson id": "FK9SG7ZT4K5A",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=yrt2qxu3ltc&list=PLsgNuGaOCZRtBCEmb6JUxOcm9dI2X3p7A",
      "thumbnail": "https://img.youtube.com/vi/yrt2qxu3ltc/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "4XZK2ITCLS37",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=Pet-8Y87BEw&list=PLsgNuGaOCZRtBCEmb6JUxOcm9dI2X3p7A&index=2",
      "thumbnail": "https://img.youtube.com/vi/Pet-8Y87BEw/maxresdefault.jpg"
    }
  ],
  "P00000006": [
    {
      "casestudy lesson id": "RNFMCD6454CA",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=RNqB5XHgivQ&list=PLGEvszL7OKkNguughc__-ToJRxgXD2JYJ",
      "thumbnail": "https://img.youtube.com/vi/RNqB5XHgivQ/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "EUGSRJ7QW1K7",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=7F7um7l5AqU&list=PLGEvszL7OKkNguughc__-ToJRxgXD2JYJ&index=2",
      "thumbnail": "https://img.youtube.com/vi/7F7um7l5AqU/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "PW9S4UGBP6Q8",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=2U6eKkAmWDg&list=PLGEvszL7OKkNguughc__-ToJRxgXD2JYJ&index=3",
      "thumbnail": "https://img.youtube.com/vi/2U6eKkAmWDg/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "R8N2TFRZ5FGV",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=BwzzJhje6ms&list=PLGEvszL7OKkNguughc__-ToJRxgXD2JYJ&index=4",
      "thumbnail": "https://img.youtube.com/vi/BwzzJhje6ms/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "XWSFL61B84BA",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=p7mcSCmxB2g&list=PLGEvszL7OKkNguughc__-ToJRxgXD2JYJ&index=5",
      "thumbnail": "https://img.youtube.com/vi/p7mcSCmxB2g/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "4UHBTNO67WH5",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=IsDYrpsX-pU&list=PLGEvszL7OKkNguughc__-ToJRxgXD2JYJ&index=6",
      "thumbnail": "https://img.youtube.com/vi/IsDYrpsX-pU/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "STYO6JGYOLTR",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=raME1ybsINc&list=PLGEvszL7OKkNguughc__-ToJRxgXD2JYJ&index=7",
      "thumbnail": "https://img.youtube.com/vi/raME1ybsINc/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "OLB3LM5B54UR",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=bdFQ79Mq1yk&list=PLGEvszL7OKkNguughc__-ToJRxgXD2JYJ&index=8",
      "thumbnail": "https://img.youtube.com/vi/bdFQ79Mq1yk/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "UFF14JQX5IFG",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=dqXq0RDWBSA&list=PLGEvszL7OKkNguughc__-ToJRxgXD2JYJ&index=9",
      "thumbnail": "https://img.youtube.com/vi/dqXq0RDWBSA/maxresdefault.jpg"
    }
  ], "P00000007": [
    {
      "casestudy lesson id": "39EEOXV14OPC",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=ZzcgdNpw_cI&list=PLifnQOsGyOSTYxFVLLZQo0MPEP2e5dh1Q",
      "thumbnail": "https://img.youtube.com/vi/ZzcgdNpw_cI/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "Q5CAS5PHGUZS",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=b1SD4PAXBQs&list=PLifnQOsGyOSTYxFVLLZQo0MPEP2e5dh1Q&index=2",
      "thumbnail": "https://img.youtube.com/vi/b1SD4PAXBQs/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "BM3QW7IIBPHA",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=WfmoqKNUwBg&list=PLifnQOsGyOSTYxFVLLZQo0MPEP2e5dh1Q&index=3",
      "thumbnail": "https://img.youtube.com/vi/WfmoqKNUwBg/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "5RM7VSIDOBM5",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=NFX5p1G1t1Q&list=PLifnQOsGyOSTYxFVLLZQo0MPEP2e5dh1Q&index=4",
      "thumbnail": "https://img.youtube.com/vi/NFX5p1G1t1Q/maxresdefault.jpg"
    },
    {
      "casestudy lesson id": "7AMW56IMB70H",
      "lesson tag": "YouTube",
      "lesson url": "https://www.youtube.com/watch?v=WfAjE5-2Vcs&list=PLifnQOsGyOSTYxFVLLZQo0MPEP2e5dh1Q&index=5",
      "thumbnail": "https://img.youtube.com/vi/WfAjE5-2Vcs/maxresdefault.jpg"
    }
  ], "P00000008": [
    {
      "casestudy lesson id": "RFZ3XH3410R0",
      "lesson tag": "YouTube",
      "lesson url": "https://www.loom.com/share/be9e59e40bcf4a018f64d6a7301e7a88?sid=0b4ab31b-8449-4b55-b1d4-dac3369a60eb",
      "thumbnail": "https://img.youtube.com/vi/be9e59e40bc/maxresdefault.jpg"
    }

  ]
};



exports.helloWorld1 = onRequest((req, res) => {
  const id = req.query.id || req.body.id; // URL 쿼리 또는 POST 요청에서 ID를 받음

  let responseData;
  responseData = jsonData[id] || [];
  if (responseData.length === 0) {
    responseData = { error: "No data found for the given ID" };
  }
  res.status(200).json({ "data": responseData });
});



