const {
  getEligibilityData,
  getRelevantPaper,
  getBenefits,
  getMembershipText,
  getApplication,
  getMember,
  getOrdinaryMember,
  getAssociateMember,
} = require("../utils/getQuery");

const router = require("express").Router();

// Eligibility
router.get("/eligibility", async (req, res) => {
  try {
    const eligibility = await getEligibilityData();
    res.status(200).json(eligibility);
  } catch (error) {
    res.status(500).json(error);
  }
});

// Relevant Papers
router.get("/relevantPaper", async (req, res) => {
  try {
    const paper = await getRelevantPaper();
    res.status(200).json(paper);
  } catch (error) {
    res.status(500).json(error);
  }
});

// Benefits of Member
router.get("/benefits", async (req, res) => {
  try {
    const data = await getBenefits();
    res.status(200).json(data);
  } catch (error) {
    res.status(500).json(error);
  }
});

// Membership Texts
router.get("/membership", async (req, res) => {
  try {
    const data = await getMembershipText();
    res.status(200).json(data);
  } catch (error) {
    res.status(500).json(error);
  }
});

// Application Procedure
router.get("/application", async (req, res) => {
  try {
    const data = await getApplication();
    res.status(200).json(data);
  } catch (error) {
    res.status(500).json(error);
  }
});

// All Member List
router.get("/memberlist", async (req, res) => {
  try {
    const data = await getMember();
    res.status(200).json(data);
  } catch (error) {
    res.status(500).json(error);
  }
});

// Ordinary Member
router.get("/ordinary", async (req, res) => {
  try {
    const data = await getOrdinaryMember();
    res.status(200).json(data);
  } catch (error) {
    res.status(500).json(error);
  }
});

// Associate Members
router.get("/associate", async (req, res) => {
  try {
    const data = await getAssociateMember();
    res.status(200).json(data);
  } catch (error) {
    res.status(500).json(error);
  }
});

module.exports = router;
