const Service = require("../models/service");

const getServiceData = async () => {
  const service = await Service.findOne().sort({ updatedAt: -1 });

  if (!service) {
    return {
      pageTitle: "",
      services: {
        title: {
          subTitle: "",
          mainTitle: "",
        },
        items: [],
      },
      destinations: {
        backgroundImage: "",
        title: {
          subTitle: "",
          mainTitle: "",
        },
      },
      visas: {
        items: [],
      },
      reviews: {
        title: {
          subTitle: "",
          mainTitle: "",
        },
        thumb: "",
        items: [],
      },
    };
  }

  return service;
};

module.exports = {
  getServiceData,
};
