const router = require("express").Router();
const {
  getFormerChairmen,
  getFormerSrViceChairmen,
  getFormerViceChairmen,
  getBOD,
  getBrief,
  getService,
  getActivities,
  getMissions,
  getSecretariat,
  getMemorandum,
} = require("../utils/getQuery");

// Get Former Chairmen
router.get("/formerChairmen", async (req, res) => {
  try {
    const formerChairmen = await getFormerChairmen();
    res.status(200).json(formerChairmen);
  } catch (error) {
    res.status(500).json(error);
  }
});

// Get Former Sr Vice Chairmen
router.get("/formerSrViceChairmen", async (req, res) => {
  try {
    const formerSrViceChairmen = await getFormerSrViceChairmen();
    res.status(200).json(formerSrViceChairmen);
  } catch (error) {
    res.status(500).json(error);
  }
});

// Get Former Vice Chairmen
router.get("/formerViceChairmen", async (req, res) => {
  try {
    const formerViceChairmen = await getFormerViceChairmen();
    res.status(200).json(formerViceChairmen);
  } catch (error) {
    res.status(500).json(error);
  }
});

// Get Board of Directors
router.get("/bod", async (req, res) => {
  try {
    const Bod = await getBOD();
    res.status(200).json(Bod);
  } catch (error) {
    res.status(500).json(error);
  }
});

// Get Brief
router.get("/brief", async (req, res) => {
  try {
    const brief = await getBrief();
    res.status(200).json(brief);
  } catch (error) {
    res.status(500).json(error);
  }
});

//  Get Service
router.get("/service", async (req, res) => {
  try {
    const service = await getService();
    res.status(200).json(service);
  } catch (error) {
    res.status(500).json(error);
  }
});

// Get Activities
router.get("/activity", async (req, res) => {
  try {
    const activity = await getActivities();
    res.status(200).json(activity);
  } catch (error) {
    res.status(500).json(error);
  }
});

// Get Mission
router.get("/mission", async (req, res) => {
  try {
    const mission = await getMissions();
    res.status(200).json(mission);
  } catch (error) {
    res.status(500).json(error);
  }
});

// Get Secretariats
router.get("/secretariat", async (req, res) => {
  try {
    const secretariat = await getSecretariat();
    res.status(200).json(secretariat);
  } catch (error) {
    res.status(500).json(error);
  }
});

// Get Memorandum
router.get("/memorandum", async (req, res) => {
  try {
    const memo = await getMemorandum();
    res.status(200).json(memo);
  } catch (error) {
    res.status(500).json(error);
  }
});

module.exports = router;
