import { factories } from "@strapi/strapi";

const POPULATE = {
  hero: { populate: { mobileImage_9x16: true, desktopImage_12x5: true } },
  stats: { populate: { cards: { populate: { icon_1x1: true } } } },
  about: { populate: { paragraphs: true } },
  companyDetails: {
    populate: {
      mapImage_1x1: true,
      companyPoints: true,
      divisionOverview: true,
    },
  },
};

export default factories.createCoreController("api::logistics.logistics", () => ({
  async find(ctx) {
    const data = await strapi
      .documents("api::logistics.logistics")!
      .findFirst({ populate: POPULATE });
    return this.transformResponse(data);
  },
}));
