import { defineStore, storeToRefs } from "pinia";
import { usePageStore } from "./page";

export const useDesignToLightStore = defineStore("design-to-light", () => {
  const { page } = storeToRefs(usePageStore());

  function isDesignToLightStep(step) {
    const isDTLEnabled = page.value.designToLight;
    return (
      isDTLEnabled &&
      page.value.designToLight.some(
        (proposal) => proposal.location.step === step.id
      )
    );
  }

  return { isDesignToLightStep };
});
