import { createId } from "@paralleldrive/cuid2";
import type { TFunction } from "i18next";
import { TSurveyElementTypeEnum } from "@formbricks/types/surveys/elements";
import type { TSurvey } from "@formbricks/types/surveys/types";
import type { TTemplate } from "@formbricks/types/templates";
import {
  buildBlock,
  buildCTAElement,
  buildCesElement,
  buildConsentElement,
  buildCsatElement,
  buildMultipleChoiceElement,
  buildNPSElement,
  buildOpenTextElement,
  buildRatingElement,
  createBlockChoiceJumpLogic,
  createBlockJumpLogic,
} from "@/app/lib/survey-block-builder";
import {
  buildSurvey,
  getDefaultSurveyPreset,
  hiddenFieldsDefault,
  withTemplateCodes,
} from "@/app/lib/survey-builder";
import { createI18nString } from "@/lib/i18n/utils";

export const CUSTOM_SURVEY_TEMPLATE_ID = "custom";

const cartAbandonmentSurvey = (t: TFunction): TTemplate => {
  const reusableElementIds = [createId(), createId(), createId()];
  const block8Id = createId(); // Pre-generate ID for Block 8 (referenced by Block 6 logic)
  const localSurvey = getDefaultSurveyPreset(t);

  return buildSurvey(
    {
      id: "cart-abandonment",
      name: t("templates.card_abandonment_survey"),
      role: "productManager",
      industries: ["eCommerce"],
      channels: ["app", "website", "link"],
      description: t("templates.card_abandonment_survey_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildCTAElement({
              id: reusableElementIds[0],
              subheader: t("templates.card_abandonment_survey_question_1_html"),
              headline: t("templates.card_abandonment_survey_question_1_headline"),
              required: false,
            }),
          ],
          buttonLabel: t("templates.card_abandonment_survey_question_1_button_label"),
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildMultipleChoiceElement({
              headline: t("templates.card_abandonment_survey_question_2_headline"),
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              subheader: t("templates.card_abandonment_survey_question_2_subheader"),
              choices: [
                t("templates.card_abandonment_survey_question_2_choice_1"),
                t("templates.card_abandonment_survey_question_2_choice_2"),
                t("templates.card_abandonment_survey_question_2_choice_3"),
                t("templates.card_abandonment_survey_question_2_choice_4"),
                t("templates.card_abandonment_survey_question_2_choice_5"),
                t("templates.card_abandonment_survey_question_2_choice_6"),
              ],
              containsOther: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.card_abandonment_survey_question_3_headline"),
              required: false,
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_4"),
          elements: [
            buildRatingElement({
              headline: t("templates.card_abandonment_survey_question_4_headline"),
              required: true,
              scale: "number",
              range: 5,
              lowerLabel: t("templates.card_abandonment_survey_question_4_lower_label"),
              upperLabel: t("templates.card_abandonment_survey_question_4_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_5"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceMulti,
              headline: t("templates.card_abandonment_survey_question_5_headline"),
              subheader: t("templates.card_abandonment_survey_question_5_subheader"),
              required: true,
              choices: [
                t("templates.card_abandonment_survey_question_5_choice_1"),
                t("templates.card_abandonment_survey_question_5_choice_2"),
                t("templates.card_abandonment_survey_question_5_choice_3"),
                t("templates.card_abandonment_survey_question_5_choice_4"),
                t("templates.card_abandonment_survey_question_5_choice_5"),
                t("templates.card_abandonment_survey_question_5_choice_6"),
              ],
              containsOther: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_6"),
          elements: [
            buildConsentElement({
              id: reusableElementIds[1],
              headline: t("templates.card_abandonment_survey_question_6_headline"),
              subheader: "",
              required: false,
              label: t("templates.card_abandonment_survey_question_6_label"),
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[1], block8Id, "isSkipped")],
          t,
        }),
        buildBlock({
          name: t("templates.block_7"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.card_abandonment_survey_question_7_headline"),
              required: true,
              inputType: "email",
              longAnswer: false,
              placeholder: "example@email.com",
            }),
          ],
          t,
        }),
        buildBlock({
          id: block8Id,
          name: t("templates.block_8"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[2],
              headline: t("templates.card_abandonment_survey_question_8_headline"),
              required: false,
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const siteAbandonmentSurvey = (t: TFunction): TTemplate => {
  const reusableElementIds = [createId(), createId(), createId()];
  const block8Id = createId(); // Pre-generate ID for Block 8 (referenced by Block 7 logic)
  const localSurvey = getDefaultSurveyPreset(t);

  return buildSurvey(
    {
      id: "site-abandonment",
      name: t("templates.site_abandonment_survey"),
      role: "productManager",
      industries: ["eCommerce"],
      channels: ["app", "website"],
      description: t("templates.site_abandonment_survey_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildCTAElement({
              id: reusableElementIds[0],
              subheader: t("templates.site_abandonment_survey_question_1_html"),
              headline: t("templates.site_abandonment_survey_question_2_headline"),
              required: false,
            }),
          ],
          buttonLabel: t("templates.site_abandonment_survey_question_2_button_label"),
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.site_abandonment_survey_question_3_headline"),
              subheader: t("templates.site_abandonment_survey_question_3_subheader"),
              required: true,
              shuffleOption: "none",
              choices: [
                t("templates.site_abandonment_survey_question_3_choice_1"),
                t("templates.site_abandonment_survey_question_3_choice_2"),
                t("templates.site_abandonment_survey_question_3_choice_3"),
                t("templates.site_abandonment_survey_question_3_choice_4"),
                t("templates.site_abandonment_survey_question_3_choice_5"),
                t("templates.site_abandonment_survey_question_3_choice_6"),
              ],
              containsOther: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.site_abandonment_survey_question_4_headline"),
              required: false,
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_4"),
          elements: [
            buildRatingElement({
              headline: t("templates.site_abandonment_survey_question_5_headline"),
              required: true,
              scale: "number",
              range: 5,
              lowerLabel: t("templates.site_abandonment_survey_question_5_lower_label"),
              upperLabel: t("templates.site_abandonment_survey_question_5_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_5"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceMulti,
              headline: t("templates.site_abandonment_survey_question_6_headline"),
              subheader: t("templates.site_abandonment_survey_question_6_subheader"),
              required: true,
              choices: [
                t("templates.site_abandonment_survey_question_6_choice_1"),
                t("templates.site_abandonment_survey_question_6_choice_2"),
                t("templates.site_abandonment_survey_question_6_choice_3"),
                t("templates.site_abandonment_survey_question_6_choice_4"),
                t("templates.site_abandonment_survey_question_6_choice_5"),
              ],
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_6"),
          elements: [
            buildConsentElement({
              id: reusableElementIds[1],
              headline: t("templates.site_abandonment_survey_question_7_headline"),
              subheader: "",
              required: false,
              label: t("templates.site_abandonment_survey_question_7_label"),
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[1], block8Id, "isSkipped")],
          t,
        }),
        buildBlock({
          name: t("templates.block_7"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.site_abandonment_survey_question_8_headline"),
              required: true,
              inputType: "email",
              longAnswer: false,
              placeholder: "example@email.com",
            }),
          ],
          t,
        }),
        buildBlock({
          id: block8Id,
          name: t("templates.block_8"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[2],
              headline: t("templates.site_abandonment_survey_question_9_headline"),
              required: false,
              inputType: "text",
            }),
          ],
          t,
        }),
      ],
    },
    t
  );
};

const productMarketFitSuperhuman = (t: TFunction): TTemplate => {
  const reusableElementIds = [createId()];
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "product-market-fit-superhuman",
      name: t("templates.product_market_fit_superhuman"),
      role: "productManager",
      industries: ["saas"],
      channels: ["app", "link"],
      description: t("templates.product_market_fit_superhuman_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildCTAElement({
              id: reusableElementIds[0],
              subheader: t("templates.product_market_fit_superhuman_question_1_html"),
              headline: t("templates.product_market_fit_superhuman_question_1_headline"),
              required: false,
            }),
          ],
          buttonLabel: t("templates.product_market_fit_superhuman_question_1_button_label"),
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.product_market_fit_superhuman_question_2_headline"),
              subheader: t("templates.product_market_fit_superhuman_question_2_subheader"),
              required: true,
              shuffleOption: "none",
              choices: [
                t("templates.product_market_fit_superhuman_question_2_choice_1"),
                t("templates.product_market_fit_superhuman_question_2_choice_2"),
                t("templates.product_market_fit_superhuman_question_2_choice_3"),
              ],
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.product_market_fit_superhuman_question_3_headline"),
              subheader: t("templates.product_market_fit_superhuman_question_3_subheader"),
              required: true,
              shuffleOption: "none",
              choices: [
                t("templates.product_market_fit_superhuman_question_3_choice_1"),
                t("templates.product_market_fit_superhuman_question_3_choice_2"),
                t("templates.product_market_fit_superhuman_question_3_choice_3"),
                t("templates.product_market_fit_superhuman_question_3_choice_4"),
                t("templates.product_market_fit_superhuman_question_3_choice_5"),
              ],
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_4"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.product_market_fit_superhuman_question_4_headline"),
              required: true,
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_5"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.product_market_fit_superhuman_question_5_headline"),
              required: true,
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_6"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.product_market_fit_superhuman_question_6_headline"),
              subheader: t("templates.product_market_fit_superhuman_question_6_subheader"),
              required: true,
              inputType: "text",
            }),
          ],
          t,
        }),
      ],
    },
    t
  );
};

const onboardingSegmentation = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "onboarding-segmentation",
      name: t("templates.onboarding_segmentation"),
      role: "productManager",
      industries: ["saas"],
      channels: ["app", "link"],
      description: t("templates.onboarding_segmentation_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.onboarding_segmentation_question_1_headline"),
              subheader: t("templates.onboarding_segmentation_question_1_subheader"),
              required: true,
              shuffleOption: "none",
              choices: [
                t("templates.onboarding_segmentation_question_1_choice_1"),
                t("templates.onboarding_segmentation_question_1_choice_2"),
                t("templates.onboarding_segmentation_question_1_choice_3"),
                t("templates.onboarding_segmentation_question_1_choice_4"),
                t("templates.onboarding_segmentation_question_1_choice_5"),
              ],
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.onboarding_segmentation_question_2_headline"),
              subheader: t("templates.onboarding_segmentation_question_2_subheader"),
              required: true,
              shuffleOption: "none",
              choices: [
                t("templates.onboarding_segmentation_question_2_choice_1"),
                t("templates.onboarding_segmentation_question_2_choice_2"),
                t("templates.onboarding_segmentation_question_2_choice_3"),
                t("templates.onboarding_segmentation_question_2_choice_4"),
                t("templates.onboarding_segmentation_question_2_choice_5"),
              ],
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.onboarding_segmentation_question_3_headline"),
              subheader: t("templates.onboarding_segmentation_question_3_subheader"),
              required: true,
              shuffleOption: "none",
              choices: [
                t("templates.onboarding_segmentation_question_3_choice_1"),
                t("templates.onboarding_segmentation_question_3_choice_2"),
                t("templates.onboarding_segmentation_question_3_choice_3"),
                t("templates.onboarding_segmentation_question_3_choice_4"),
                t("templates.onboarding_segmentation_question_3_choice_5"),
              ],
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const churnSurvey = (t: TFunction): TTemplate => {
  const reusableElementIds = [createId(), createId(), createId(), createId(), createId()];
  const reusableOptionIds = [createId(), createId(), createId(), createId(), createId()];
  const block2Id = createId(); // Pre-generate IDs for blocks referenced by logic
  const block3Id = createId();
  const block4Id = createId();
  const block5Id = createId();
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "churn-survey",
      name: t("templates.churn_survey"),
      role: "sales",
      industries: ["saas", "eCommerce", "other"],
      channels: ["app", "link"],
      description: t("templates.churn_survey_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              id: reusableElementIds[0],
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              shuffleOption: "none",
              choices: [
                t("templates.churn_survey_question_1_choice_1"),
                t("templates.churn_survey_question_1_choice_2"),
                t("templates.churn_survey_question_1_choice_3"),
                t("templates.churn_survey_question_1_choice_4"),
                t("templates.churn_survey_question_1_choice_5"),
              ],
              choiceIds: [
                reusableOptionIds[0],
                reusableOptionIds[1],
                reusableOptionIds[2],
                reusableOptionIds[3],
                reusableOptionIds[4],
              ],
              headline: t("templates.churn_survey_question_1_headline"),
              required: true,
              subheader: t("templates.churn_survey_question_1_subheader"),
            }),
          ],
          logic: [
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[0], block2Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[1], block3Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[2], block4Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[3], block5Id),
            createBlockChoiceJumpLogic(
              reusableElementIds[0],
              reusableOptionIds[4],
              localSurvey.endings[0].id
            ),
          ],
          t,
        }),
        buildBlock({
          id: block2Id,
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[1],
              headline: t("templates.churn_survey_question_2_headline"),
              required: true,
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[1], localSurvey.endings[0].id, "isSubmitted")],
          buttonLabel: t("templates.churn_survey_question_2_button_label"),
          t,
        }),
        buildBlock({
          id: block3Id,
          name: t("templates.block_3"),
          elements: [
            buildCTAElement({
              id: reusableElementIds[2],
              subheader: t("templates.churn_survey_question_3_html"),
              headline: t("templates.churn_survey_question_3_headline"),
              required: false,
              buttonUrl:
                "https://formbricks.com?utm_source=formbricks-app&utm_medium=survey&utm_campaign=template_cta_churn_survey",
              buttonExternal: true,
              ctaButtonLabel: t("templates.churn_survey_question_3_button_label"),
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[2], localSurvey.endings[0].id, "isClicked")],
          t,
        }),
        buildBlock({
          id: block4Id,
          name: t("templates.block_4"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[3],
              headline: t("templates.churn_survey_question_4_headline"),
              required: true,
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[3], localSurvey.endings[0].id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block5Id,
          name: t("templates.block_5"),
          elements: [
            buildCTAElement({
              id: reusableElementIds[4],
              subheader: t("templates.churn_survey_question_5_html"),
              headline: t("templates.churn_survey_question_5_headline"),
              required: false,
              buttonUrl: "mailto:ceo@company.com",
              buttonExternal: true,
              ctaButtonLabel: t("templates.churn_survey_question_5_button_label"),
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[4], localSurvey.endings[0].id, "isClicked")],
          t,
        }),
      ],
    },
    t
  );
};

const earnedAdvocacyScore = (t: TFunction): TTemplate => {
  const reusableElementIds = [createId(), createId(), createId(), createId()];
  const reusableOptionIds = [createId(), createId(), createId(), createId()];
  const block3Id = createId(); // Pre-generate ID for Block 3 (referenced by Block 1 logic)
  const block4Id = createId();
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "earned-advocacy-score",
      name: t("templates.earned_advocacy_score_name"),
      role: "customerSuccess",
      industries: ["saas", "eCommerce", "other"],
      channels: ["app", "link"],
      description: t("templates.earned_advocacy_score_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              id: reusableElementIds[0],
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              shuffleOption: "none",
              choices: [
                t("templates.earned_advocacy_score_question_1_choice_1"),
                t("templates.earned_advocacy_score_question_1_choice_2"),
              ],
              choiceIds: [reusableOptionIds[0], reusableOptionIds[1]],
              headline: t("templates.earned_advocacy_score_question_1_headline"),
              required: true,
            }),
          ],
          logic: [createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[1], block3Id)],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[1],
              headline: t("templates.earned_advocacy_score_question_2_headline"),
              required: true,
              placeholder: t("templates.earned_advocacy_score_question_2_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[1], block4Id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block3Id,
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[2],
              headline: t("templates.earned_advocacy_score_question_3_headline"),
              required: true,
              placeholder: t("templates.earned_advocacy_score_question_3_placeholder"),
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          id: block4Id,
          name: t("templates.block_4"),
          elements: [
            buildMultipleChoiceElement({
              id: reusableElementIds[3],
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              shuffleOption: "none",
              choices: [
                t("templates.earned_advocacy_score_question_4_choice_1"),
                t("templates.earned_advocacy_score_question_4_choice_2"),
              ],
              choiceIds: [reusableOptionIds[2], reusableOptionIds[3]],
              headline: t("templates.earned_advocacy_score_question_4_headline"),
              required: true,
            }),
          ],
          logic: [
            createBlockChoiceJumpLogic(
              reusableElementIds[3],
              reusableOptionIds[3],
              localSurvey.endings[0].id
            ),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_5"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.earned_advocacy_score_question_5_headline"),
              required: true,
              placeholder: t("templates.earned_advocacy_score_question_5_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const usabilityScoreRatingSurvey = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "usability-score-rating",
      name: t("templates.usability_score_name"),
      role: "customerSuccess",
      industries: ["saas"],
      channels: ["app", "link"],
      description: t("templates.usability_rating_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.usability_question_1_headline"),
              required: true,
              lowerLabel: t("templates.strongly_disagree"),
              upperLabel: t("templates.strongly_agree"),
              isColorCodingEnabled: false,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.usability_question_2_headline"),
              required: true,
              lowerLabel: t("templates.strongly_disagree"),
              upperLabel: t("templates.strongly_agree"),
              isColorCodingEnabled: false,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.usability_question_3_headline"),
              required: true,
              lowerLabel: t("templates.strongly_disagree"),
              upperLabel: t("templates.strongly_agree"),
              isColorCodingEnabled: false,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_4"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.usability_question_4_headline"),
              required: true,
              lowerLabel: t("templates.strongly_disagree"),
              upperLabel: t("templates.strongly_agree"),
              isColorCodingEnabled: false,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_5"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.usability_question_5_headline"),
              required: true,
              lowerLabel: t("templates.strongly_disagree"),
              upperLabel: t("templates.strongly_agree"),
              isColorCodingEnabled: false,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_6"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.usability_question_6_headline"),
              required: true,
              lowerLabel: t("templates.strongly_disagree"),
              upperLabel: t("templates.strongly_agree"),
              isColorCodingEnabled: false,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_7"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.usability_question_7_headline"),
              required: true,
              lowerLabel: t("templates.strongly_disagree"),
              upperLabel: t("templates.strongly_agree"),
              isColorCodingEnabled: false,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_8"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.usability_question_8_headline"),
              required: true,
              lowerLabel: t("templates.strongly_disagree"),
              upperLabel: t("templates.strongly_agree"),
              isColorCodingEnabled: false,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_9"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.usability_question_9_headline"),
              required: true,
              lowerLabel: t("templates.strongly_disagree"),
              upperLabel: t("templates.strongly_agree"),
              isColorCodingEnabled: false,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_10"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.usability_question_10_headline"),
              required: true,
              lowerLabel: t("templates.strongly_disagree"),
              upperLabel: t("templates.strongly_agree"),
              isColorCodingEnabled: false,
            }),
          ],
          t,
        }),
      ],
    },
    t
  );
};

const improveTrialConversion = (t: TFunction): TTemplate => {
  const reusableElementIds = [createId(), createId(), createId(), createId(), createId(), createId()];
  const reusableOptionIds = [
    createId(),
    createId(),
    createId(),
    createId(),
    createId(),
    createId(),
    createId(),
  ];
  const block2Id = createId(); // Pre-generate IDs for blocks referenced by logic
  const block3Id = createId();
  const block4Id = createId();
  const block5Id = createId();
  const block6Id = createId(); // Block 6 referenced by blocks 2, 3, and 5
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "improve-trial-conversion",
      name: t("templates.improve_trial_conversion_name"),
      role: "sales",
      industries: ["saas"],
      channels: ["link", "app"],
      description: t("templates.improve_trial_conversion_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              id: reusableElementIds[0],
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              shuffleOption: "none",
              choices: [
                t("templates.improve_trial_conversion_question_1_choice_1"),
                t("templates.improve_trial_conversion_question_1_choice_2"),
                t("templates.improve_trial_conversion_question_1_choice_3"),
                t("templates.improve_trial_conversion_question_1_choice_4"),
                t("templates.improve_trial_conversion_question_1_choice_5"),
              ],
              choiceIds: [
                reusableOptionIds[0],
                reusableOptionIds[1],
                reusableOptionIds[2],
                reusableOptionIds[3],
                reusableOptionIds[4],
              ],
              headline: t("templates.improve_trial_conversion_question_1_headline"),
              required: true,
              subheader: t("templates.improve_trial_conversion_question_1_subheader"),
            }),
          ],
          logic: [
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[0], block2Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[1], block3Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[2], block4Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[3], block5Id),
            createBlockChoiceJumpLogic(
              reusableElementIds[0],
              reusableOptionIds[4],
              localSurvey.endings[0].id
            ),
          ],
          t,
        }),
        buildBlock({
          id: block2Id,
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[1],
              headline: t("templates.improve_trial_conversion_question_2_headline"),
              required: true,
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[1], block6Id, "isSubmitted")],
          buttonLabel: t("templates.improve_trial_conversion_question_2_button_label"),
          t,
        }),
        buildBlock({
          id: block3Id,
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[2],
              headline: t("templates.improve_trial_conversion_question_3_headline"),
              required: true,
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[2], block6Id, "isSubmitted")],
          buttonLabel: t("templates.improve_trial_conversion_question_3_button_label"),
          t,
        }),
        buildBlock({
          id: block4Id,
          name: t("templates.block_4"),
          elements: [
            buildCTAElement({
              id: reusableElementIds[3],
              subheader: t("templates.improve_trial_conversion_question_4_html"),
              headline: t("templates.improve_trial_conversion_question_4_headline"),
              required: false,
              buttonUrl:
                "https://formbricks.com/github?utm_source=formbricks-app&utm_medium=survey&utm_campaign=template_cta_trial_conversion",
              buttonExternal: true,
              ctaButtonLabel: t("templates.improve_trial_conversion_question_4_button_label"),
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[3], localSurvey.endings[0].id, "isClicked")],
          t,
        }),
        buildBlock({
          id: block5Id,
          name: t("templates.block_5"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[4],
              headline: t("templates.improve_trial_conversion_question_5_headline"),
              required: true,
              subheader: t("templates.improve_trial_conversion_question_5_subheader"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[4], block6Id, "isSubmitted")],
          buttonLabel: t("templates.improve_trial_conversion_question_5_button_label"),
          t,
        }),
        buildBlock({
          id: block6Id,
          name: t("templates.block_6"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[5],
              headline: t("templates.improve_trial_conversion_question_6_headline"),
              required: false,
              subheader: t("templates.improve_trial_conversion_question_6_subheader"),
              inputType: "text",
            }),
          ],
          logic: [
            createBlockJumpLogic(reusableElementIds[5], localSurvey.endings[0].id, "isSubmitted"),
            createBlockJumpLogic(reusableElementIds[5], localSurvey.endings[0].id, "isSkipped"),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const reviewPrompt = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  const reusableElementIds = [createId(), createId(), createId()];
  const block3Id = createId(); // Pre-generate ID for Block 3 (referenced by Block 1 logic)

  return buildSurvey(
    {
      id: "review-prompt",
      name: t("templates.review_prompt_name"),
      role: "marketing",
      industries: ["saas", "eCommerce", "other"],
      channels: ["link", "app"],
      description: t("templates.review_prompt_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              id: reusableElementIds[0],
              range: 5,
              scale: "star",
              headline: t("templates.review_prompt_question_1_headline"),
              required: true,
              lowerLabel: t("templates.review_prompt_question_1_lower_label"),
              upperLabel: t("templates.review_prompt_question_1_upper_label"),
              isColorCodingEnabled: false,
            }),
          ],
          logic: [
            {
              id: createId(),
              conditions: {
                id: createId(),
                connector: "and",
                conditions: [
                  {
                    id: createId(),
                    leftOperand: {
                      value: reusableElementIds[0],
                      type: "element",
                    },
                    operator: "isLessThanOrEqual",
                    rightOperand: {
                      type: "static",
                      value: 3,
                    },
                  },
                ],
              },
              actions: [
                {
                  id: createId(),
                  objective: "jumpToBlock",
                  target: block3Id,
                },
              ],
            },
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildCTAElement({
              id: reusableElementIds[1],
              subheader: t("templates.review_prompt_question_2_html"),
              headline: t("templates.review_prompt_question_2_headline"),
              required: false,
              buttonUrl:
                "https://formbricks.com/github?utm_source=formbricks-app&utm_medium=survey&utm_campaign=template_cta_review_prompt",
              buttonExternal: true,
              ctaButtonLabel: t("templates.review_prompt_question_2_button_label"),
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[1], localSurvey.endings[0].id, "isClicked")],
          buttonLabel: t("templates.next"),
          backButtonLabel: t("templates.back"),
          t,
        }),
        buildBlock({
          id: block3Id,
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[2],
              headline: t("templates.review_prompt_question_3_headline"),
              required: true,
              subheader: t("templates.review_prompt_question_3_subheader"),
              placeholder: t("templates.review_prompt_question_3_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.review_prompt_question_3_button_label"),
          t,
        }),
      ],
    },
    t
  );
};

const interviewPrompt = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "interview-prompt",
      name: t("templates.interview_prompt_name"),
      role: "productManager",
      industries: ["saas"],
      channels: ["app"],
      description: t("templates.interview_prompt_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildCTAElement({
              headline: t("templates.interview_prompt_question_1_headline"),
              subheader: t("templates.interview_prompt_question_1_html"),
              buttonUrl: "https://cal.com/johannes",
              buttonExternal: true,
              required: false,
              ctaButtonLabel: t("templates.interview_prompt_question_1_button_label"),
            }),
          ],
          buttonLabel: t("templates.next"),
          t,
        }),
      ],
    },
    t
  );
};

const improveActivationRate = (t: TFunction): TTemplate => {
  const reusableElementIds = [createId(), createId(), createId(), createId(), createId(), createId()];
  const reusableOptionIds = [createId(), createId(), createId(), createId(), createId()];
  const block3Id = createId(); // Pre-generate IDs for blocks referenced by logic
  const block4Id = createId();
  const block5Id = createId();
  const block6Id = createId();
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "improve-activation-rate",
      name: t("templates.improve_activation_rate_name"),
      role: "productManager",
      industries: ["saas"],
      channels: ["link"],
      description: t("templates.improve_activation_rate_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              id: reusableElementIds[0],
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              shuffleOption: "none",
              choices: [
                t("templates.improve_activation_rate_question_1_choice_1"),
                t("templates.improve_activation_rate_question_1_choice_2"),
                t("templates.improve_activation_rate_question_1_choice_3"),
                t("templates.improve_activation_rate_question_1_choice_4"),
                t("templates.improve_activation_rate_question_1_choice_5"),
              ],
              choiceIds: [
                reusableOptionIds[0],
                reusableOptionIds[1],
                reusableOptionIds[2],
                reusableOptionIds[3],
                reusableOptionIds[4],
              ],
              headline: t("templates.improve_activation_rate_question_1_headline"),
              required: true,
            }),
          ],
          logic: [
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[1], block3Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[2], block4Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[3], block5Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[4], block6Id),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[1],
              headline: t("templates.improve_activation_rate_question_2_headline"),
              required: true,
              placeholder: t("templates.improve_activation_rate_question_2_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[1], localSurvey.endings[0].id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block3Id,
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[2],
              headline: t("templates.improve_activation_rate_question_3_headline"),
              required: true,
              placeholder: t("templates.improve_activation_rate_question_3_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[2], localSurvey.endings[0].id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block4Id,
          name: t("templates.block_4"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[3],
              headline: t("templates.improve_activation_rate_question_4_headline"),
              required: true,
              placeholder: t("templates.improve_activation_rate_question_4_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[3], localSurvey.endings[0].id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block5Id,
          name: t("templates.block_5"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[4],
              headline: t("templates.improve_activation_rate_question_5_headline"),
              required: true,
              placeholder: t("templates.improve_activation_rate_question_5_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[4], localSurvey.endings[0].id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block6Id,
          name: t("templates.block_6"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[5],
              headline: t("templates.improve_activation_rate_question_6_headline"),
              required: false,
              subheader: t("templates.improve_activation_rate_question_6_subheader"),
              placeholder: t("templates.improve_activation_rate_question_6_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const employeeSatisfaction = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "employee-satisfaction",
      name: t("templates.employee_satisfaction_name"),
      role: "peopleManager",
      industries: ["saas", "eCommerce", "other"],
      channels: ["app", "link"],
      description: t("templates.employee_satisfaction_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildCsatElement({
              scale: "star",
              headline: t("templates.employee_satisfaction_question_1_headline"),
              required: true,
              lowerLabel: t("templates.employee_satisfaction_question_1_lower_label"),
              upperLabel: t("templates.employee_satisfaction_question_1_upper_label"),
              isColorCodingEnabled: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              shuffleOption: "none",
              choices: [
                t("templates.employee_satisfaction_question_2_choice_1"),
                t("templates.employee_satisfaction_question_2_choice_2"),
                t("templates.employee_satisfaction_question_2_choice_3"),
                t("templates.employee_satisfaction_question_2_choice_4"),
                t("templates.employee_satisfaction_question_2_choice_5"),
              ],
              headline: t("templates.employee_satisfaction_question_2_headline"),
              required: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.employee_satisfaction_question_3_headline"),
              required: false,
              placeholder: t("templates.employee_satisfaction_question_3_placeholder"),
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_4"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.employee_satisfaction_question_5_headline"),
              required: true,
              lowerLabel: t("templates.employee_satisfaction_question_5_lower_label"),
              upperLabel: t("templates.employee_satisfaction_question_5_upper_label"),
              isColorCodingEnabled: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_5"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.employee_satisfaction_question_6_headline"),
              required: false,
              placeholder: t("templates.employee_satisfaction_question_6_placeholder"),
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_6"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              shuffleOption: "none",
              choices: [
                t("templates.employee_satisfaction_question_7_choice_1"),
                t("templates.employee_satisfaction_question_7_choice_2"),
                t("templates.employee_satisfaction_question_7_choice_3"),
                t("templates.employee_satisfaction_question_7_choice_4"),
                t("templates.employee_satisfaction_question_7_choice_5"),
              ],
              headline: t("templates.employee_satisfaction_question_7_headline"),
              required: true,
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const uncoverStrengthsAndWeaknesses = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "uncover-strengths-and-weaknesses",
      name: t("templates.uncover_strengths_and_weaknesses_name"),
      role: "productManager",
      industries: ["saas", "other"],
      channels: ["app", "link"],
      description: t("templates.uncover_strengths_and_weaknesses_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              shuffleOption: "none",
              choices: [
                t("templates.uncover_strengths_and_weaknesses_question_1_choice_1"),
                t("templates.uncover_strengths_and_weaknesses_question_1_choice_2"),
                t("templates.uncover_strengths_and_weaknesses_question_1_choice_3"),
                t("templates.uncover_strengths_and_weaknesses_question_1_choice_4"),
                t("templates.uncover_strengths_and_weaknesses_question_1_choice_5"),
              ],
              headline: t("templates.uncover_strengths_and_weaknesses_question_1_headline"),
              required: true,
              containsOther: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              shuffleOption: "none",
              choices: [
                t("templates.uncover_strengths_and_weaknesses_question_2_choice_1"),
                t("templates.uncover_strengths_and_weaknesses_question_2_choice_2"),
                t("templates.uncover_strengths_and_weaknesses_question_2_choice_3"),
                t("templates.uncover_strengths_and_weaknesses_question_2_choice_4"),
              ],
              headline: t("templates.uncover_strengths_and_weaknesses_question_2_headline"),
              required: true,
              subheader: t("templates.uncover_strengths_and_weaknesses_question_2_subheader"),
              containsOther: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.uncover_strengths_and_weaknesses_question_3_headline"),
              required: false,
              subheader: t("templates.uncover_strengths_and_weaknesses_question_3_subheader"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const productMarketFitShort = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "product-market-fit-short",
      name: t("templates.product_market_fit_short_name"),
      role: "productManager",
      industries: ["saas"],
      channels: ["app", "link"],
      description: t("templates.product_market_fit_short_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.product_market_fit_short_question_1_headline"),
              subheader: t("templates.product_market_fit_short_question_1_subheader"),
              required: true,
              shuffleOption: "none",
              choices: [
                t("templates.product_market_fit_short_question_1_choice_1"),
                t("templates.product_market_fit_short_question_1_choice_2"),
                t("templates.product_market_fit_short_question_1_choice_3"),
              ],
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.product_market_fit_short_question_2_headline"),
              subheader: t("templates.product_market_fit_short_question_2_subheader"),
              required: true,
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const marketAttribution = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "market-attribution",
      name: t("templates.market_attribution_name"),
      role: "marketing",
      industries: ["saas", "eCommerce"],
      channels: ["website", "app", "link"],
      description: t("templates.market_attribution_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.market_attribution_question_1_headline"),
              subheader: t("templates.market_attribution_question_1_subheader"),
              required: true,
              shuffleOption: "none",
              choices: [
                t("templates.market_attribution_question_1_choice_1"),
                t("templates.market_attribution_question_1_choice_2"),
                t("templates.market_attribution_question_1_choice_3"),
                t("templates.market_attribution_question_1_choice_4"),
                t("templates.market_attribution_question_1_choice_5"),
              ],
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const changingSubscriptionExperience = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "changing-subscription-experience",
      name: t("templates.changing_subscription_experience_name"),
      role: "productManager",
      industries: ["saas"],
      channels: ["app"],
      description: t("templates.changing_subscription_experience_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.changing_subscription_experience_question_1_headline"),
              required: true,
              shuffleOption: "none",
              choices: [
                t("templates.changing_subscription_experience_question_1_choice_1"),
                t("templates.changing_subscription_experience_question_1_choice_2"),
                t("templates.changing_subscription_experience_question_1_choice_3"),
                t("templates.changing_subscription_experience_question_1_choice_4"),
                t("templates.changing_subscription_experience_question_1_choice_5"),
              ],
            }),
          ],
          buttonLabel: t("templates.next"),
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.changing_subscription_experience_question_2_headline"),
              required: true,
              shuffleOption: "none",
              choices: [
                t("templates.changing_subscription_experience_question_2_choice_1"),
                t("templates.changing_subscription_experience_question_2_choice_2"),
                t("templates.changing_subscription_experience_question_2_choice_3"),
              ],
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const identifyCustomerGoals = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "identify-customer-goals",
      name: t("templates.identify_customer_goals_name"),
      role: "productManager",
      industries: ["saas", "other"],
      channels: ["app", "website"],
      description: t("templates.identify_customer_goals_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.identify_customer_goals_question_1_headline"),
              required: true,
              shuffleOption: "none",
              choices: [
                t("templates.identify_customer_goals_question_1_choice_1"),
                t("templates.identify_customer_goals_question_1_choice_2"),
                t("templates.identify_customer_goals_question_1_choice_3"),
                t("templates.identify_customer_goals_question_1_choice_4"),
              ],
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const featureChaser = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "feature-chaser",
      name: t("templates.feature_chaser_name"),
      role: "productManager",
      industries: ["saas"],
      channels: ["app"],
      description: t("templates.feature_chaser_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.feature_chaser_question_1_headline"),
              required: true,
              lowerLabel: t("templates.feature_chaser_question_1_lower_label"),
              upperLabel: t("templates.feature_chaser_question_1_upper_label"),
              isColorCodingEnabled: false,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              shuffleOption: "none",
              choices: [
                t("templates.feature_chaser_question_2_choice_1"),
                t("templates.feature_chaser_question_2_choice_2"),
                t("templates.feature_chaser_question_2_choice_3"),
                t("templates.feature_chaser_question_2_choice_4"),
              ],
              headline: t("templates.feature_chaser_question_2_headline"),
              required: true,
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const fakeDoorFollowUp = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "fake-door-follow-up",
      name: t("templates.fake_door_follow_up_name"),
      role: "productManager",
      industries: ["saas", "eCommerce"],
      channels: ["app", "website"],
      description: t("templates.fake_door_follow_up_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              headline: t("templates.fake_door_follow_up_question_1_headline"),
              required: true,
              lowerLabel: t("templates.fake_door_follow_up_question_1_lower_label"),
              upperLabel: t("templates.fake_door_follow_up_question_1_upper_label"),
              range: 5,
              scale: "number",
              isColorCodingEnabled: false,
            }),
          ],
          buttonLabel: t("templates.next"),
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceMulti,
              headline: t("templates.fake_door_follow_up_question_2_headline"),
              required: false,
              shuffleOption: "none",
              choices: [
                t("templates.fake_door_follow_up_question_2_choice_1"),
                t("templates.fake_door_follow_up_question_2_choice_2"),
                t("templates.fake_door_follow_up_question_2_choice_3"),
                t("templates.fake_door_follow_up_question_2_choice_4"),
              ],
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const feedbackBox = (t: TFunction): TTemplate => {
  const reusableElementIds = [createId(), createId(), createId(), createId()];
  const reusableOptionIds = [createId(), createId()];
  const block2Id = createId(); // Pre-generate IDs for blocks referenced by logic
  const block3Id = createId(); // Block 3 referenced by block 2
  const block4Id = createId();
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "feedback-box",
      name: t("templates.feedback_box_name"),
      role: "productManager",
      industries: ["saas"],
      channels: ["app"],
      description: t("templates.feedback_box_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              id: reusableElementIds[0],
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              shuffleOption: "none",
              choices: [
                t("templates.feedback_box_question_1_choice_1"),
                t("templates.feedback_box_question_1_choice_2"),
              ],
              choiceIds: [reusableOptionIds[0], reusableOptionIds[1]],
              headline: t("templates.feedback_box_question_1_headline"),
              required: true,
              subheader: t("templates.feedback_box_question_1_subheader"),
            }),
          ],
          logic: [
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[0], block2Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[1], block4Id),
          ],
          buttonLabel: t("templates.next"),
          t,
        }),
        buildBlock({
          id: block2Id,
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[1],
              headline: t("templates.feedback_box_question_2_headline"),
              required: true,
              subheader: t("templates.feedback_box_question_2_subheader"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[1], block3Id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block3Id,
          name: t("templates.block_3"),
          elements: [
            buildCTAElement({
              id: reusableElementIds[2],
              subheader: t("templates.feedback_box_question_3_html"),
              headline: t("templates.feedback_box_question_3_headline"),
              required: false,
            }),
          ],
          buttonLabel: t("templates.feedback_box_question_3_button_label"),
          t,
        }),
        buildBlock({
          id: block4Id,
          name: t("templates.block_4"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[3],
              headline: t("templates.feedback_box_question_4_headline"),
              required: true,
              subheader: t("templates.feedback_box_question_4_subheader"),
              placeholder: t("templates.feedback_box_question_4_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.feedback_box_question_4_button_label"),
          t,
        }),
      ],
    },
    t
  );
};

const integrationSetupSurvey = (t: TFunction): TTemplate => {
  const reusableElementIds = [createId(), createId(), createId()];
  const block3Id = createId(); // Pre-generate ID for Block 3 (referenced by Block 1 logic)
  const localSurvey = getDefaultSurveyPreset(t);

  return buildSurvey(
    {
      id: "integration-setup-survey",
      name: t("templates.integration_setup_survey_name"),
      role: "productManager",
      industries: ["saas"],
      channels: ["app"],
      description: t("templates.integration_setup_survey_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              id: reusableElementIds[0],
              range: 5,
              scale: "number",
              headline: t("templates.integration_setup_survey_question_1_headline"),
              required: true,
              lowerLabel: t("templates.integration_setup_survey_question_1_lower_label"),
              upperLabel: t("templates.integration_setup_survey_question_1_upper_label"),
              isColorCodingEnabled: false,
            }),
          ],
          logic: [
            {
              id: createId(),
              conditions: {
                id: createId(),
                connector: "and",
                conditions: [
                  {
                    id: createId(),
                    leftOperand: {
                      value: reusableElementIds[0],
                      type: "element",
                    },
                    operator: "isGreaterThanOrEqual",
                    rightOperand: {
                      type: "static",
                      value: 4,
                    },
                  },
                ],
              },
              actions: [
                {
                  id: createId(),
                  objective: "jumpToBlock",
                  target: block3Id,
                },
              ],
            },
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[1],
              headline: t("templates.integration_setup_survey_question_2_headline"),
              required: false,
              placeholder: t("templates.integration_setup_survey_question_2_placeholder"),
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          id: block3Id,
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[2],
              headline: t("templates.integration_setup_survey_question_3_headline"),
              required: false,
              subheader: t("templates.integration_setup_survey_question_3_subheader"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const newIntegrationSurvey = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "new-integration-survey",
      name: t("templates.new_integration_survey_name"),
      role: "productManager",
      industries: ["saas"],
      channels: ["app"],
      description: t("templates.new_integration_survey_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.new_integration_survey_question_1_headline"),
              required: true,
              shuffleOption: "none",
              choices: [
                t("templates.new_integration_survey_question_1_choice_1"),
                t("templates.new_integration_survey_question_1_choice_2"),
                t("templates.new_integration_survey_question_1_choice_3"),
                t("templates.new_integration_survey_question_1_choice_4"),
                t("templates.new_integration_survey_question_1_choice_5"),
              ],
              containsOther: true,
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const docsFeedback = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "docs-feedback",
      name: t("templates.docs_feedback_name"),
      role: "productManager",
      industries: ["saas"],
      channels: ["app", "website", "link"],
      description: t("templates.docs_feedback_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.docs_feedback_question_1_headline"),
              required: true,
              shuffleOption: "none",
              choices: [
                t("templates.docs_feedback_question_1_choice_1"),
                t("templates.docs_feedback_question_1_choice_2"),
              ],
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.docs_feedback_question_2_headline"),
              required: false,
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.docs_feedback_question_3_headline"),
              required: false,
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const nps = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "nps",
      name: t("templates.nps_survey_name"),
      role: "customerSuccess",
      industries: ["saas", "eCommerce", "other"],
      channels: ["app", "link", "website"],
      description: t("templates.nps_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildNPSElement({
              headline: t("templates.nps_survey_question_1_headline"),
              required: true,
              lowerLabel: t("templates.nps_survey_question_1_lower_label"),
              upperLabel: t("templates.nps_survey_question_1_upper_label"),
              isColorCodingEnabled: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.nps_survey_question_2_headline"),
              required: false,
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.nps_survey_question_3_headline"),
              required: false,
              inputType: "text",
            }),
          ],
          t,
        }),
      ],
    },
    t
  );
};

const starRatingSurvey = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  const template = buildSurvey(
    {
      id: "star-rating",
      name: t("workspace.xm-templates.five_star_rating"),
      role: "customerSuccess",
      industries: ["saas", "eCommerce", "other"],
      channels: ["app", "link", "website"],
      description: t("workspace.xm-templates.five_star_rating_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "star",
              headline: t("templates.star_rating_survey_question_1_headline"),
              required: true,
              lowerLabel: t("templates.star_rating_survey_question_1_lower_label"),
              upperLabel: t("templates.star_rating_survey_question_1_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.star_rating_survey_question_3_headline"),
              required: false,
              subheader: t("templates.star_rating_survey_question_3_subheader"),
              placeholder: t("templates.star_rating_survey_question_3_placeholder"),
              inputType: "text",
            }),
          ],
          t,
        }),
      ],
    },
    t
  );

  return {
    ...template,
    preset: {
      ...template.preset,
      name: t("templates.star_rating_survey_name"),
    },
  };
};

const customerSatisfactionScore = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  const template = buildSurvey(
    {
      id: "csat",
      name: t("workspace.xm-templates.csat"),
      role: "customerSuccess",
      industries: ["saas", "eCommerce", "other"],
      channels: ["app", "link", "website"],
      description: t("templates.csat_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildCsatElement({
              scale: "smiley",
              headline: t("templates.csat_survey_question_1_headline"),
              required: true,
              lowerLabel: t("templates.csat_survey_question_1_lower_label"),
              upperLabel: t("templates.csat_survey_question_1_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.csat_survey_question_2_headline"),
              required: false,
              placeholder: t("templates.csat_survey_question_2_placeholder"),
              inputType: "text",
            }),
          ],
          t,
        }),
      ],
    },
    t
  );

  return {
    ...template,
    preset: {
      ...template.preset,
      name: t("templates.csat_survey_name"),
    },
  };
};

const collectFeedback = (t: TFunction): TTemplate => {
  const reusableElementIds = [
    createId(),
    createId(),
    createId(),
    createId(),
    createId(),
    createId(),
    createId(),
  ];
  const block3Id = createId(); // Pre-generate IDs for blocks referenced by logic
  const block4Id = createId();
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "collect-feedback",
      name: t("templates.collect_feedback_name"),
      role: "productManager",
      industries: ["other", "eCommerce"],
      channels: ["website", "link"],
      description: t("templates.collect_feedback_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              id: reusableElementIds[0],
              range: 5,
              scale: "star",
              headline: t("templates.collect_feedback_question_1_headline"),
              subheader: t("templates.collect_feedback_question_1_subheader"),
              required: true,
              lowerLabel: t("templates.collect_feedback_question_1_lower_label"),
              upperLabel: t("templates.collect_feedback_question_1_upper_label"),
              isColorCodingEnabled: false,
            }),
          ],
          logic: [
            {
              id: createId(),
              conditions: {
                id: createId(),
                connector: "and",
                conditions: [
                  {
                    id: createId(),
                    leftOperand: {
                      value: reusableElementIds[0],
                      type: "element",
                    },
                    operator: "isLessThanOrEqual",
                    rightOperand: {
                      type: "static",
                      value: 3,
                    },
                  },
                ],
              },
              actions: [
                {
                  id: createId(),
                  objective: "jumpToBlock",
                  target: block3Id,
                },
              ],
            },
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[1],
              headline: t("templates.collect_feedback_question_2_headline"),
              required: true,
              longAnswer: true,
              placeholder: t("templates.collect_feedback_question_2_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [
            {
              id: createId(),
              conditions: {
                id: createId(),
                connector: "and",
                conditions: [
                  {
                    id: createId(),
                    leftOperand: {
                      value: reusableElementIds[1],
                      type: "element",
                    },
                    operator: "isSubmitted",
                  },
                ],
              },
              actions: [
                {
                  id: createId(),
                  objective: "jumpToBlock",
                  target: block4Id,
                },
              ],
            },
          ],
          t,
        }),
        buildBlock({
          id: block3Id,
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[2],
              headline: t("templates.collect_feedback_question_3_headline"),
              required: true,
              longAnswer: true,
              placeholder: t("templates.collect_feedback_question_3_placeholder"),
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          id: block4Id,
          name: t("templates.block_4"),
          elements: [
            buildRatingElement({
              id: reusableElementIds[3],
              range: 5,
              scale: "smiley",
              headline: t("templates.collect_feedback_question_4_headline"),
              required: true,
              lowerLabel: t("templates.collect_feedback_question_4_lower_label"),
              upperLabel: t("templates.collect_feedback_question_4_upper_label"),
              isColorCodingEnabled: false,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_5"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[4],
              headline: t("templates.collect_feedback_question_5_headline"),
              required: false,
              longAnswer: true,
              placeholder: t("templates.collect_feedback_question_5_placeholder"),
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_6"),
          elements: [
            buildMultipleChoiceElement({
              id: reusableElementIds[5],
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              choices: [
                t("templates.collect_feedback_question_6_choice_1"),
                t("templates.collect_feedback_question_6_choice_2"),
                t("templates.collect_feedback_question_6_choice_3"),
                t("templates.collect_feedback_question_6_choice_4"),
                t("templates.collect_feedback_question_6_choice_5"),
              ],
              headline: t("templates.collect_feedback_question_6_headline"),
              required: true,
              shuffleOption: "none",
              containsOther: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_7"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[6],
              headline: t("templates.collect_feedback_question_7_headline"),
              required: false,
              inputType: "email",
              longAnswer: false,
              placeholder: t("templates.collect_feedback_question_7_placeholder"),
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const identifyUpsellOpportunities = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "identify-upsell-opportunities",
      name: t("templates.identify_upsell_opportunities_name"),
      role: "sales",
      industries: ["saas"],
      channels: ["app", "link"],
      description: t("templates.identify_upsell_opportunities_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.identify_upsell_opportunities_question_1_headline"),
              required: true,
              shuffleOption: "none",
              choices: [
                t("templates.identify_upsell_opportunities_question_1_choice_1"),
                t("templates.identify_upsell_opportunities_question_1_choice_2"),
                t("templates.identify_upsell_opportunities_question_1_choice_3"),
                t("templates.identify_upsell_opportunities_question_1_choice_4"),
              ],
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const prioritizeFeatures = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "prioritize-features",
      name: t("templates.prioritize_features_name"),
      role: "productManager",
      industries: ["saas"],
      channels: ["app"],
      description: t("templates.prioritize_features_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              shuffleOption: "none",
              choices: [
                t("templates.prioritize_features_question_1_choice_1"),
                t("templates.prioritize_features_question_1_choice_2"),
                t("templates.prioritize_features_question_1_choice_3"),
                t("templates.prioritize_features_question_1_choice_4"),
              ],
              headline: t("templates.prioritize_features_question_1_headline"),
              required: true,
              containsOther: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              shuffleOption: "none",
              choices: [
                t("templates.prioritize_features_question_2_choice_1"),
                t("templates.prioritize_features_question_2_choice_2"),
                t("templates.prioritize_features_question_2_choice_3"),
              ],
              headline: t("templates.prioritize_features_question_2_headline"),
              required: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.prioritize_features_question_3_headline"),
              required: true,
              placeholder: t("templates.prioritize_features_question_3_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const gaugeFeatureSatisfaction = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "gauge-feature-satisfaction",
      name: t("templates.gauge_feature_satisfaction_name"),
      role: "productManager",
      industries: ["saas"],
      channels: ["app"],
      description: t("templates.gauge_feature_satisfaction_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              headline: t("templates.gauge_feature_satisfaction_question_1_headline"),
              required: true,
              lowerLabel: t("templates.gauge_feature_satisfaction_question_1_lower_label"),
              upperLabel: t("templates.gauge_feature_satisfaction_question_1_upper_label"),
              scale: "number",
              range: 5,
              isColorCodingEnabled: false,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.gauge_feature_satisfaction_question_2_headline"),
              required: false,
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const marketSiteClarity = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "market-site-clarity",
      name: t("templates.market_site_clarity_name"),
      role: "marketing",
      industries: ["saas", "eCommerce", "other"],
      channels: ["website"],
      description: t("templates.market_site_clarity_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.market_site_clarity_question_1_headline"),
              required: true,
              shuffleOption: "none",
              choices: [
                t("templates.market_site_clarity_question_1_choice_1"),
                t("templates.market_site_clarity_question_1_choice_2"),
                t("templates.market_site_clarity_question_1_choice_3"),
              ],
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.market_site_clarity_question_2_headline"),
              required: false,
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildCTAElement({
              headline: t("templates.market_site_clarity_question_3_headline"),
              subheader: "",
              required: false,
              buttonUrl: "https://app.formbricks.com/auth/signup",
              buttonExternal: true,
              ctaButtonLabel: t("templates.market_site_clarity_question_3_button_label"),
            }),
          ],
          buttonLabel: t("templates.next"),
          t,
        }),
      ],
    },
    t
  );
};

const customerEffortScore = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "ces",
      name: t("templates.cess_survey_name"),
      role: "productManager",
      industries: ["saas", "eCommerce", "other"],
      channels: ["app", "link", "website"],
      description: t("templates.customer_effort_score_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildCesElement({
              range: 5,
              scale: "number",
              headline: t("templates.cess_survey_question_1_headline"),
              required: true,
              lowerLabel: t("templates.cess_survey_question_1_lower_label"),
              upperLabel: t("templates.cess_survey_question_1_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.cess_survey_question_2_headline"),
              required: true,
              placeholder: t("templates.cess_survey_question_2_placeholder"),
              inputType: "text",
            }),
          ],
          t,
        }),
      ],
    },
    t
  );
};

const smileysSurvey = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "smileys",
      name: t("templates.smileys_survey_name"),
      role: "customerSuccess",
      industries: ["saas", "eCommerce", "other"],
      channels: ["app", "link", "website"],
      description: t("workspace.xm-templates.smileys_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildCsatElement({
              scale: "smiley",
              headline: t("templates.smileys_survey_question_1_headline"),
              required: true,
              lowerLabel: t("templates.smileys_survey_question_1_lower_label"),
              upperLabel: t("templates.smileys_survey_question_1_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.smileys_survey_question_3_headline"),
              required: false,
              subheader: t("templates.smileys_survey_question_3_subheader"),
              placeholder: t("templates.smileys_survey_question_3_placeholder"),
              inputType: "text",
            }),
          ],
          t,
        }),
      ],
    },
    t
  );
};

const enpsSurvey = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "enps",
      name: t("templates.enps_survey_name"),
      role: "peopleManager",
      industries: ["saas", "eCommerce", "other"],
      channels: ["app", "link", "website"],
      description: t("workspace.xm-templates.enps_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildNPSElement({
              headline: t("templates.enps_survey_question_1_headline"),
              required: false,
              lowerLabel: t("templates.enps_survey_question_1_lower_label"),
              upperLabel: t("templates.enps_survey_question_1_upper_label"),
              isColorCodingEnabled: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.enps_survey_question_2_headline"),
              required: false,
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.enps_survey_question_3_headline"),
              required: false,
              inputType: "text",
            }),
          ],
          t,
        }),
      ],
    },
    t
  );
};

const careerDevelopmentSurvey = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "career-development-survey",
      name: t("templates.career_development_survey_name"),
      role: "peopleManager",
      industries: ["saas", "eCommerce", "other"],
      channels: ["link"],
      description: t("templates.career_development_survey_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.career_development_survey_question_1_headline"),
              lowerLabel: t("templates.career_development_survey_question_1_lower_label"),
              upperLabel: t("templates.career_development_survey_question_1_upper_label"),
              required: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.career_development_survey_question_2_headline"),
              lowerLabel: t("templates.career_development_survey_question_2_lower_label"),
              upperLabel: t("templates.career_development_survey_question_2_upper_label"),
              required: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.career_development_survey_question_3_headline"),
              lowerLabel: t("templates.career_development_survey_question_3_lower_label"),
              upperLabel: t("templates.career_development_survey_question_3_upper_label"),
              required: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_4"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.career_development_survey_question_4_headline"),
              lowerLabel: t("templates.career_development_survey_question_4_lower_label"),
              upperLabel: t("templates.career_development_survey_question_4_upper_label"),
              required: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_5"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.career_development_survey_question_5_headline"),
              subheader: t("templates.career_development_survey_question_5_subheader"),
              required: true,
              shuffleOption: "none",
              choices: [
                t("templates.career_development_survey_question_5_choice_1"),
                t("templates.career_development_survey_question_5_choice_2"),
                t("templates.career_development_survey_question_5_choice_3"),
                t("templates.career_development_survey_question_5_choice_4"),
                t("templates.career_development_survey_question_5_choice_5"),
                t("templates.career_development_survey_question_5_choice_6"),
              ],
              containsOther: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_6"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.career_development_survey_question_6_headline"),
              subheader: t("templates.career_development_survey_question_6_subheader"),
              required: true,
              shuffleOption: "exceptLast",
              choices: [
                t("templates.career_development_survey_question_6_choice_1"),
                t("templates.career_development_survey_question_6_choice_2"),
                t("templates.career_development_survey_question_6_choice_3"),
                t("templates.career_development_survey_question_6_choice_4"),
                t("templates.career_development_survey_question_6_choice_5"),
                t("templates.career_development_survey_question_6_choice_6"),
              ],
              containsOther: true,
            }),
          ],
          t,
        }),
      ],
    },
    t
  );
};

const professionalDevelopmentSurvey = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "professional-development-survey",
      name: t("templates.professional_development_survey_name"),
      role: "peopleManager",
      industries: ["saas", "eCommerce", "other"],
      channels: ["link"],
      description: t("templates.professional_development_survey_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.professional_development_survey_question_1_headline"),
              required: true,
              shuffleOption: "none",
              choices: [
                t("templates.professional_development_survey_question_1_choice_1"),
                t("templates.professional_development_survey_question_1_choice_2"),
              ],
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceMulti,
              headline: t("templates.professional_development_survey_question_2_headline"),
              subheader: t("templates.professional_development_survey_question_2_subheader"),
              required: true,
              shuffleOption: "exceptLast",
              choices: [
                t("templates.professional_development_survey_question_2_choice_1"),
                t("templates.professional_development_survey_question_2_choice_2"),
                t("templates.professional_development_survey_question_2_choice_3"),
                t("templates.professional_development_survey_question_2_choice_4"),
                t("templates.professional_development_survey_question_2_choice_5"),
                t("templates.professional_development_survey_question_2_choice_6"),
              ],
              containsOther: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              headline: t("templates.professional_development_survey_question_3_headline"),
              required: true,
              shuffleOption: "none",
              choices: [
                t("templates.professional_development_survey_question_3_choice_1"),
                t("templates.professional_development_survey_question_3_choice_2"),
              ],
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_4"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.professional_development_survey_question_4_headline"),
              lowerLabel: t("templates.professional_development_survey_question_4_lower_label"),
              upperLabel: t("templates.professional_development_survey_question_4_upper_label"),
              required: true,
              isColorCodingEnabled: false,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_5"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceMulti,
              headline: t("templates.professional_development_survey_question_5_headline"),
              required: true,
              shuffleOption: "exceptLast",
              choices: [
                t("templates.professional_development_survey_question_5_choice_1"),
                t("templates.professional_development_survey_question_5_choice_2"),
                t("templates.professional_development_survey_question_5_choice_3"),
                t("templates.professional_development_survey_question_5_choice_4"),
                t("templates.professional_development_survey_question_5_choice_5"),
                t("templates.professional_development_survey_question_5_choice_6"),
              ],
              containsOther: true,
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const rateCheckoutExperience = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  const reusableElementIds = [createId(), createId(), createId()];
  const block3Id = createId(); // Pre-generate ID for Block 3 (referenced by Block 1 logic)
  return buildSurvey(
    {
      id: "rate-checkout-experience",
      name: t("templates.rate_checkout_experience_name"),
      role: "productManager",
      industries: ["eCommerce"],
      channels: ["website", "app"],
      description: t("templates.rate_checkout_experience_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              id: reusableElementIds[0],
              range: 5,
              scale: "number",
              headline: t("templates.rate_checkout_experience_question_1_headline"),
              required: true,
              lowerLabel: t("templates.rate_checkout_experience_question_1_lower_label"),
              upperLabel: t("templates.rate_checkout_experience_question_1_upper_label"),
              isColorCodingEnabled: false,
            }),
          ],
          logic: [
            {
              id: createId(),
              conditions: {
                id: createId(),
                connector: "and",
                conditions: [
                  {
                    id: createId(),
                    leftOperand: {
                      value: reusableElementIds[0],
                      type: "element",
                    },
                    operator: "isGreaterThanOrEqual",
                    rightOperand: {
                      type: "static",
                      value: 4,
                    },
                  },
                ],
              },
              actions: [
                {
                  id: createId(),
                  objective: "jumpToBlock",
                  target: block3Id,
                },
              ],
            },
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[1],
              headline: t("templates.rate_checkout_experience_question_2_headline"),
              required: true,
              placeholder: t("templates.rate_checkout_experience_question_2_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[1], localSurvey.endings[0].id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block3Id,
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[2],
              headline: t("templates.rate_checkout_experience_question_3_headline"),
              required: true,
              placeholder: t("templates.rate_checkout_experience_question_3_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const measureSearchExperience = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  const reusableElementIds = [createId(), createId(), createId()];
  const block3Id = createId(); // Pre-generate ID for Block 3 (referenced by Block 1 logic)
  return buildSurvey(
    {
      id: "measure-search-experience",
      name: t("templates.measure_search_experience_name"),
      role: "productManager",
      industries: ["saas", "eCommerce"],
      channels: ["app", "website"],
      description: t("templates.measure_search_experience_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              id: reusableElementIds[0],
              range: 5,
              scale: "number",
              headline: t("templates.measure_search_experience_question_1_headline"),
              required: true,
              lowerLabel: t("templates.measure_search_experience_question_1_lower_label"),
              upperLabel: t("templates.measure_search_experience_question_1_upper_label"),
              isColorCodingEnabled: false,
            }),
          ],
          logic: [
            {
              id: createId(),
              conditions: {
                id: createId(),
                connector: "and",
                conditions: [
                  {
                    id: createId(),
                    leftOperand: {
                      value: reusableElementIds[0],
                      type: "element",
                    },
                    operator: "isGreaterThanOrEqual",
                    rightOperand: {
                      type: "static",
                      value: 4,
                    },
                  },
                ],
              },
              actions: [
                {
                  id: createId(),
                  objective: "jumpToBlock",
                  target: block3Id,
                },
              ],
            },
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[1],
              headline: t("templates.measure_search_experience_question_2_headline"),
              required: true,
              placeholder: t("templates.measure_search_experience_question_2_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[1], localSurvey.endings[0].id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block3Id,
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[2],
              headline: t("templates.measure_search_experience_question_3_headline"),
              required: true,
              placeholder: t("templates.measure_search_experience_question_3_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const evaluateContentQuality = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  const reusableElementIds = [createId(), createId(), createId()];
  const block3Id = createId(); // Pre-generate ID for Block 3 (referenced by Block 1 logic)
  return buildSurvey(
    {
      id: "evaluate-content-quality",
      name: t("templates.evaluate_content_quality_name"),
      role: "marketing",
      industries: ["other"],
      channels: ["website"],
      description: t("templates.evaluate_content_quality_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              id: reusableElementIds[0],
              range: 5,
              scale: "number",
              headline: t("templates.evaluate_content_quality_question_1_headline"),
              required: true,
              lowerLabel: t("templates.evaluate_content_quality_question_1_lower_label"),
              upperLabel: t("templates.evaluate_content_quality_question_1_upper_label"),
              isColorCodingEnabled: false,
            }),
          ],
          logic: [
            {
              id: createId(),
              conditions: {
                id: createId(),
                connector: "and",
                conditions: [
                  {
                    id: createId(),
                    leftOperand: {
                      value: reusableElementIds[0],
                      type: "element",
                    },
                    operator: "isGreaterThanOrEqual",
                    rightOperand: {
                      type: "static",
                      value: 4,
                    },
                  },
                ],
              },
              actions: [
                {
                  id: createId(),
                  objective: "jumpToBlock",
                  target: block3Id,
                },
              ],
            },
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[1],
              headline: t("templates.evaluate_content_quality_question_2_headline"),
              required: true,
              placeholder: t("templates.evaluate_content_quality_question_2_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[1], localSurvey.endings[0].id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block3Id,
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[2],
              headline: t("templates.evaluate_content_quality_question_3_headline"),
              required: true,
              placeholder: t("templates.evaluate_content_quality_question_3_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const measureTaskAccomplishment = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  const reusableElementIds = [createId(), createId(), createId(), createId(), createId()];
  const reusableOptionIds = [createId(), createId(), createId()];
  const block2Id = createId(); // Pre-generate IDs for blocks referenced by logic
  const block4Id = createId();
  const block5Id = createId();
  return buildSurvey(
    {
      id: "measure-task-accomplishment",
      name: t("templates.measure_task_accomplishment_name"),
      role: "productManager",
      industries: ["saas"],
      channels: ["app", "website"],
      description: t("templates.measure_task_accomplishment_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              id: reusableElementIds[0],
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              shuffleOption: "none",
              choices: [
                t("templates.measure_task_accomplishment_question_1_option_1_label"),
                t("templates.measure_task_accomplishment_question_1_option_2_label"),
                t("templates.measure_task_accomplishment_question_1_option_3_label"),
              ],
              choiceIds: [reusableOptionIds[0], reusableOptionIds[1], reusableOptionIds[2]],
              headline: t("templates.measure_task_accomplishment_question_1_headline"),
              required: true,
            }),
          ],
          logic: [
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[1], block4Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[0], block2Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[2], block5Id),
          ],
          t,
        }),
        buildBlock({
          id: block2Id,
          name: t("templates.block_2"),
          elements: [
            buildRatingElement({
              id: reusableElementIds[1],
              range: 5,
              scale: "number",
              headline: t("templates.measure_task_accomplishment_question_2_headline"),
              required: false,
              lowerLabel: t("templates.measure_task_accomplishment_question_2_lower_label"),
              upperLabel: t("templates.measure_task_accomplishment_question_2_upper_label"),
              isColorCodingEnabled: false,
            }),
          ],
          logic: [
            {
              id: createId(),
              conditions: {
                id: createId(),
                connector: "and",
                conditions: [
                  {
                    id: createId(),
                    leftOperand: {
                      value: reusableElementIds[1],
                      type: "element",
                    },
                    operator: "isGreaterThanOrEqual",
                    rightOperand: {
                      type: "static",
                      value: 4,
                    },
                  },
                ],
              },
              actions: [
                {
                  id: createId(),
                  objective: "jumpToBlock",
                  target: block4Id,
                },
              ],
            },
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[2],
              headline: t("templates.measure_task_accomplishment_question_3_headline"),
              required: false,
              placeholder: t("templates.measure_task_accomplishment_question_3_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [
            {
              id: createId(),
              conditions: {
                id: createId(),
                connector: "or",
                conditions: [
                  {
                    id: createId(),
                    leftOperand: {
                      value: reusableElementIds[2],
                      type: "element",
                    },
                    operator: "isSubmitted",
                  },
                  {
                    id: createId(),
                    leftOperand: {
                      value: reusableElementIds[1],
                      type: "element",
                    },
                    operator: "isSkipped",
                  },
                ],
              },
              actions: [
                {
                  id: createId(),
                  objective: "jumpToBlock",
                  target: localSurvey.endings[0].id,
                },
              ],
            },
          ],
          t,
        }),
        buildBlock({
          id: block4Id,
          name: t("templates.block_4"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[3],
              headline: t("templates.measure_task_accomplishment_question_4_headline"),
              required: false,
              inputType: "text",
            }),
          ],
          logic: [
            {
              id: createId(),
              conditions: {
                id: createId(),
                connector: "or",
                conditions: [
                  {
                    id: createId(),
                    leftOperand: {
                      value: reusableElementIds[3],
                      type: "element",
                    },
                    operator: "isSubmitted",
                  },
                  {
                    id: createId(),
                    leftOperand: {
                      value: reusableElementIds[1],
                      type: "element",
                    },
                    operator: "isSkipped",
                  },
                ],
              },
              actions: [
                {
                  id: createId(),
                  objective: "jumpToBlock",
                  target: localSurvey.endings[0].id,
                },
              ],
            },
          ],
          buttonLabel: t("templates.measure_task_accomplishment_question_4_button_label"),
          t,
        }),
        buildBlock({
          id: block5Id,
          name: t("templates.block_5"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[4],
              headline: t("templates.measure_task_accomplishment_question_5_headline"),
              required: true,
              placeholder: t("templates.measure_task_accomplishment_question_5_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.measure_task_accomplishment_question_5_button_label"),
          t,
        }),
      ],
    },
    t
  );
};

const identifySignUpBarriers = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  const reusableElementIds = [
    createId(),
    createId(),
    createId(),
    createId(),
    createId(),
    createId(),
    createId(),
    createId(),
    createId(),
  ];
  const reusableOptionIds = [createId(), createId(), createId(), createId(), createId()];
  const block4Id = createId(); // Pre-generate IDs for blocks referenced by logic
  const block5Id = createId();
  const block6Id = createId();
  const block7Id = createId();
  const block8Id = createId();
  const block9Id = createId();
  return buildSurvey(
    {
      id: "identify-sign-up-barriers",
      name: t("templates.identify_sign_up_barriers_name"),
      role: "marketing",
      industries: ["saas", "eCommerce", "other"],
      channels: ["website"],
      description: t("templates.identify_sign_up_barriers_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildCTAElement({
              id: reusableElementIds[0],
              subheader: t("templates.identify_sign_up_barriers_question_1_html"),
              headline: t("templates.identify_sign_up_barriers_question_1_headline"),
              required: false,
            }),
          ],
          buttonLabel: t("templates.identify_sign_up_barriers_question_1_button_label"),
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildRatingElement({
              id: reusableElementIds[1],
              range: 5,
              scale: "number",
              headline: t("templates.identify_sign_up_barriers_question_2_headline"),
              required: true,
              lowerLabel: t("templates.identify_sign_up_barriers_question_2_lower_label"),
              upperLabel: t("templates.identify_sign_up_barriers_question_2_upper_label"),
              isColorCodingEnabled: false,
            }),
          ],
          logic: [
            {
              id: createId(),
              conditions: {
                id: createId(),
                connector: "and",
                conditions: [
                  {
                    id: createId(),
                    leftOperand: {
                      value: reusableElementIds[1],
                      type: "element",
                    },
                    operator: "equals",
                    rightOperand: {
                      type: "static",
                      value: 5,
                    },
                  },
                ],
              },
              actions: [
                {
                  id: createId(),
                  objective: "jumpToBlock",
                  target: localSurvey.endings[0].id,
                },
              ],
            },
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildMultipleChoiceElement({
              id: reusableElementIds[2],
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              shuffleOption: "none",
              choices: [
                t("templates.identify_sign_up_barriers_question_3_choice_1_label"),
                t("templates.identify_sign_up_barriers_question_3_choice_2_label"),
                t("templates.identify_sign_up_barriers_question_3_choice_3_label"),
                t("templates.identify_sign_up_barriers_question_3_choice_4_label"),
                t("templates.identify_sign_up_barriers_question_3_choice_5_label"),
              ],
              choiceIds: [
                reusableOptionIds[0],
                reusableOptionIds[1],
                reusableOptionIds[2],
                reusableOptionIds[3],
                reusableOptionIds[4],
              ],
              headline: t("templates.identify_sign_up_barriers_question_3_headline"),
              required: true,
            }),
          ],
          logic: [
            createBlockChoiceJumpLogic(reusableElementIds[2], reusableOptionIds[0], block4Id),
            createBlockChoiceJumpLogic(reusableElementIds[2], reusableOptionIds[1], block5Id),
            createBlockChoiceJumpLogic(reusableElementIds[2], reusableOptionIds[2], block6Id),
            createBlockChoiceJumpLogic(reusableElementIds[2], reusableOptionIds[3], block7Id),
            createBlockChoiceJumpLogic(reusableElementIds[2], reusableOptionIds[4], block8Id),
          ],
          t,
        }),
        buildBlock({
          id: block4Id,
          name: t("templates.block_4"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[3],
              headline: t("templates.identify_sign_up_barriers_question_4_headline"),
              required: true,
              placeholder: t("templates.identify_sign_up_barriers_question_4_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[3], block9Id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block5Id,
          name: t("templates.block_5"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[4],
              headline: t("templates.identify_sign_up_barriers_question_5_headline"),
              required: true,
              placeholder: t("templates.identify_sign_up_barriers_question_5_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[4], block9Id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block6Id,
          name: t("templates.block_6"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[5],
              headline: t("templates.identify_sign_up_barriers_question_6_headline"),
              required: true,
              placeholder: t("templates.identify_sign_up_barriers_question_6_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[5], block9Id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block7Id,
          name: t("templates.block_7"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[6],
              headline: t("templates.identify_sign_up_barriers_question_7_headline"),
              required: true,
              placeholder: t("templates.identify_sign_up_barriers_question_7_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[6], block9Id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block8Id,
          name: t("templates.block_8"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[7],
              headline: t("templates.identify_sign_up_barriers_question_8_headline"),
              required: true,
              placeholder: t("templates.identify_sign_up_barriers_question_8_placeholder"),
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          id: block9Id,
          name: t("templates.block_9"),
          elements: [
            buildCTAElement({
              id: reusableElementIds[8],
              subheader: t("templates.identify_sign_up_barriers_question_9_html"),
              headline: t("templates.identify_sign_up_barriers_question_9_headline"),
              required: false,
              buttonUrl: "https://app.formbricks.com/auth/signup",
              buttonExternal: true,
              ctaButtonLabel: t("templates.identify_sign_up_barriers_question_9_button_label"),
            }),
          ],
          t,
        }),
      ],
    },
    t
  );
};

const buildProductRoadmap = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "build-product-roadmap",
      name: t("templates.build_product_roadmap_name"),
      role: "productManager",
      industries: ["saas"],
      channels: ["app", "link"],
      description: t("templates.build_product_roadmap_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.build_product_roadmap_question_1_headline"),
              required: true,
              lowerLabel: t("templates.build_product_roadmap_question_1_lower_label"),
              upperLabel: t("templates.build_product_roadmap_question_1_upper_label"),
              isColorCodingEnabled: false,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.build_product_roadmap_question_2_headline"),
              required: true,
              placeholder: t("templates.build_product_roadmap_question_2_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const understandPurchaseIntention = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  const reusableElementIds = [createId(), createId(), createId()];
  const block2Id = createId(); // Pre-generate IDs for blocks referenced by logic
  const block3Id = createId();
  return buildSurvey(
    {
      id: "understand-purchase-intention",
      name: t("templates.understand_purchase_intention_name"),
      role: "sales",
      industries: ["eCommerce"],
      channels: ["website", "link", "app"],
      description: t("templates.understand_purchase_intention_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              id: reusableElementIds[0],
              range: 5,
              scale: "number",
              headline: t("templates.understand_purchase_intention_question_1_headline"),
              required: true,
              lowerLabel: t("templates.understand_purchase_intention_question_1_lower_label"),
              upperLabel: t("templates.understand_purchase_intention_question_1_upper_label"),
              isColorCodingEnabled: false,
            }),
          ],
          logic: [
            createBlockChoiceJumpLogic(reusableElementIds[0], 2, block2Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], 3, block3Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], 4, block3Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], 5, localSurvey.endings[0].id),
          ],
          t,
        }),
        buildBlock({
          id: block2Id,
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[1],
              headline: t("templates.understand_purchase_intention_question_2_headline"),
              required: false,
              placeholder: t("templates.understand_purchase_intention_question_2_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [
            createBlockJumpLogic(reusableElementIds[1], localSurvey.endings[0].id, "isSubmitted"),
            createBlockJumpLogic(reusableElementIds[1], localSurvey.endings[0].id, "isSkipped"),
          ],
          t,
        }),
        buildBlock({
          id: block3Id,
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[2],
              headline: t("templates.understand_purchase_intention_question_3_headline"),
              required: true,
              placeholder: t("templates.understand_purchase_intention_question_3_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const improveNewsletterContent = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  const reusableElementIds = [createId(), createId(), createId()];
  const block2Id = createId(); // Pre-generate IDs for blocks referenced by logic
  const block3Id = createId();
  return buildSurvey(
    {
      id: "improve-newsletter-content",
      name: t("templates.improve_newsletter_content_name"),
      role: "marketing",
      industries: ["eCommerce", "saas", "other"],
      channels: ["link"],
      description: t("templates.improve_newsletter_content_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildCsatElement({
              id: reusableElementIds[0],
              scale: "smiley",
              headline: t("templates.improve_newsletter_content_question_1_headline"),
              required: true,
              lowerLabel: t("templates.improve_newsletter_content_question_1_lower_label"),
              upperLabel: t("templates.improve_newsletter_content_question_1_upper_label"),
              isColorCodingEnabled: false,
            }),
          ],
          logic: [
            createBlockChoiceJumpLogic(reusableElementIds[0], 5, block3Id),
            {
              id: createId(),
              conditions: {
                id: createId(),
                connector: "and",
                conditions: [
                  {
                    id: createId(),
                    leftOperand: {
                      value: reusableElementIds[0],
                      type: "element",
                    },
                    operator: "isLessThan",
                    rightOperand: {
                      type: "static",
                      value: 5,
                    },
                  },
                ],
              },
              actions: [
                {
                  id: createId(),
                  objective: "jumpToBlock",
                  target: block2Id,
                },
              ],
            },
          ],
          t,
        }),
        buildBlock({
          id: block2Id,
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[1],
              headline: t("templates.improve_newsletter_content_question_2_headline"),
              required: false,
              placeholder: t("templates.improve_newsletter_content_question_2_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [
            createBlockJumpLogic(reusableElementIds[1], localSurvey.endings[0].id, "isSubmitted"),
            createBlockJumpLogic(reusableElementIds[1], localSurvey.endings[0].id, "isSkipped"),
          ],
          t,
        }),
        buildBlock({
          id: block3Id,
          name: t("templates.block_3"),
          elements: [
            buildCTAElement({
              id: reusableElementIds[2],
              subheader: t("templates.improve_newsletter_content_question_3_html"),
              headline: t("templates.improve_newsletter_content_question_3_headline"),
              required: false,
              buttonUrl:
                "https://formbricks.com?utm_source=formbricks-app&utm_medium=survey&utm_campaign=template_cta_newsletter",
              buttonExternal: true,
              ctaButtonLabel: t("templates.improve_newsletter_content_question_3_button_label"),
            }),
          ],
          t,
        }),
      ],
    },
    t
  );
};

const evaluateAProductIdea = (t: TFunction): TTemplate => {
  const reusableElementIds = [
    createId(),
    createId(),
    createId(),
    createId(),
    createId(),
    createId(),
    createId(),
    createId(),
  ];
  const block3Id = createId(); // Pre-generate IDs for blocks referenced by logic
  const block4Id = createId();
  const block6Id = createId();
  const block7Id = createId();
  const block8Id = createId();
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "evaluate-a-product-idea",
      name: t("templates.evaluate_a_product_idea_name"),
      role: "productManager",
      industries: ["saas", "other"],
      channels: ["link", "app"],
      description: t("templates.evaluate_a_product_idea_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildCTAElement({
              id: reusableElementIds[0],
              subheader: t("templates.evaluate_a_product_idea_question_1_html"),
              headline: t("templates.evaluate_a_product_idea_question_1_headline"),
              required: false,
            }),
          ],
          buttonLabel: t("templates.evaluate_a_product_idea_question_1_button_label"),
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildRatingElement({
              id: reusableElementIds[1],
              range: 5,
              scale: "number",
              headline: t("templates.evaluate_a_product_idea_question_2_headline"),
              required: true,
              lowerLabel: t("templates.evaluate_a_product_idea_question_2_lower_label"),
              upperLabel: t("templates.evaluate_a_product_idea_question_2_upper_label"),
              isColorCodingEnabled: false,
            }),
          ],
          logic: [
            createBlockChoiceJumpLogic(reusableElementIds[1], 3, block3Id),
            createBlockChoiceJumpLogic(reusableElementIds[1], 4, block4Id),
          ],
          t,
        }),
        buildBlock({
          id: block3Id,
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[2],
              headline: t("templates.evaluate_a_product_idea_question_3_headline"),
              required: true,
              placeholder: t("templates.evaluate_a_product_idea_question_3_placeholder"),
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          id: block4Id,
          name: t("templates.block_4"),
          elements: [
            buildCTAElement({
              id: reusableElementIds[3],
              subheader: t("templates.evaluate_a_product_idea_question_4_html"),
              headline: t("templates.evaluate_a_product_idea_question_4_headline"),
              required: false,
            }),
          ],
          buttonLabel: t("templates.evaluate_a_product_idea_question_4_button_label"),
          t,
        }),
        buildBlock({
          name: t("templates.block_5"),
          elements: [
            buildRatingElement({
              id: reusableElementIds[4],
              range: 5,
              scale: "number",
              headline: t("templates.evaluate_a_product_idea_question_5_headline"),
              required: true,
              lowerLabel: t("templates.evaluate_a_product_idea_question_5_lower_label"),
              upperLabel: t("templates.evaluate_a_product_idea_question_5_upper_label"),
              isColorCodingEnabled: false,
            }),
          ],
          logic: [
            createBlockChoiceJumpLogic(reusableElementIds[4], 3, block6Id),
            createBlockChoiceJumpLogic(reusableElementIds[4], 4, block7Id),
          ],
          t,
        }),
        buildBlock({
          id: block6Id,
          name: t("templates.block_6"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[5],
              headline: t("templates.evaluate_a_product_idea_question_6_headline"),
              required: true,
              placeholder: t("templates.evaluate_a_product_idea_question_6_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[5], block8Id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block7Id,
          name: t("templates.block_7"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[6],
              headline: t("templates.evaluate_a_product_idea_question_7_headline"),
              required: true,
              placeholder: t("templates.evaluate_a_product_idea_question_7_placeholder"),
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          id: block8Id,
          name: t("templates.block_8"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[7],
              headline: t("templates.evaluate_a_product_idea_question_8_headline"),
              required: false,
              placeholder: t("templates.evaluate_a_product_idea_question_8_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const understandLowEngagement = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  const reusableElementIds = [createId(), createId(), createId(), createId(), createId(), createId()];
  const reusableOptionIds = [createId(), createId(), createId(), createId()];
  const block2Id = createId(); // Pre-generate IDs for blocks referenced by logic
  const block3Id = createId();
  const block4Id = createId();
  const block5Id = createId();
  const block6Id = createId();
  return buildSurvey(
    {
      id: "understand-low-engagement",
      name: t("templates.understand_low_engagement_name"),
      role: "productManager",
      industries: ["saas"],
      channels: ["link"],
      description: t("templates.understand_low_engagement_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildMultipleChoiceElement({
              id: reusableElementIds[0],
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              shuffleOption: "none",
              choices: [
                t("templates.understand_low_engagement_question_1_choice_1"),
                t("templates.understand_low_engagement_question_1_choice_2"),
                t("templates.understand_low_engagement_question_1_choice_3"),
                t("templates.understand_low_engagement_question_1_choice_4"),
                t("templates.understand_low_engagement_question_1_choice_5"),
              ],
              choiceIds: [
                reusableOptionIds[0],
                reusableOptionIds[1],
                reusableOptionIds[2],
                reusableOptionIds[3],
              ],
              headline: t("templates.understand_low_engagement_question_1_headline"),
              required: true,
              containsOther: true,
            }),
          ],
          logic: [
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[0], block2Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[1], block3Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[2], block4Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], reusableOptionIds[3], block5Id),
            createBlockChoiceJumpLogic(reusableElementIds[0], "other", block6Id),
          ],
          t,
        }),
        buildBlock({
          id: block2Id,
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[1],
              headline: t("templates.understand_low_engagement_question_2_headline"),
              required: true,
              placeholder: t("templates.understand_low_engagement_question_2_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[1], localSurvey.endings[0].id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block3Id,
          name: t("templates.block_3"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[2],
              headline: t("templates.understand_low_engagement_question_3_headline"),
              required: true,
              placeholder: t("templates.understand_low_engagement_question_3_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[2], localSurvey.endings[0].id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block4Id,
          name: t("templates.block_4"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[3],
              headline: t("templates.understand_low_engagement_question_4_headline"),
              required: true,
              placeholder: t("templates.understand_low_engagement_question_4_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[3], localSurvey.endings[0].id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block5Id,
          name: t("templates.block_5"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[4],
              headline: t("templates.understand_low_engagement_question_5_headline"),
              required: true,
              placeholder: t("templates.understand_low_engagement_question_5_placeholder"),
              inputType: "text",
            }),
          ],
          logic: [createBlockJumpLogic(reusableElementIds[4], localSurvey.endings[0].id, "isSubmitted")],
          t,
        }),
        buildBlock({
          id: block6Id,
          name: t("templates.block_6"),
          elements: [
            buildOpenTextElement({
              id: reusableElementIds[5],
              headline: t("templates.understand_low_engagement_question_6_headline"),
              required: false,
              placeholder: t("templates.understand_low_engagement_question_6_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const employeeWellBeing = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "employee-well-being",
      name: t("templates.employee_well_being_name"),
      role: "peopleManager",
      industries: ["saas", "eCommerce", "other"],
      channels: ["link"],
      description: t("templates.employee_well_being_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              headline: t("templates.employee_well_being_question_1_headline"),
              required: true,
              scale: "number",
              range: 10,
              lowerLabel: t("templates.employee_well_being_question_1_lower_label"),
              upperLabel: t("templates.employee_well_being_question_1_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildRatingElement({
              headline: t("templates.employee_well_being_question_2_headline"),
              required: true,
              scale: "number",
              range: 10,
              lowerLabel: t("templates.employee_well_being_question_2_lower_label"),
              upperLabel: t("templates.employee_well_being_question_2_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildRatingElement({
              headline: t("templates.employee_well_being_question_3_headline"),
              required: true,
              scale: "number",
              range: 10,
              lowerLabel: t("templates.employee_well_being_question_3_lower_label"),
              upperLabel: t("templates.employee_well_being_question_3_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_4"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.employee_well_being_question_4_headline"),
              required: false,
              placeholder: t("templates.employee_well_being_question_4_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const longTermRetentionCheckIn = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "long-term-retention-check-in",
      name: t("templates.long_term_retention_check_in_name"),
      role: "peopleManager",
      industries: ["saas", "other"],
      channels: ["app", "link"],
      description: t("templates.long_term_retention_check_in_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "star",
              headline: t("templates.long_term_retention_check_in_question_1_headline"),
              required: true,
              lowerLabel: t("templates.long_term_retention_check_in_question_1_lower_label"),
              upperLabel: t("templates.long_term_retention_check_in_question_1_upper_label"),
              isColorCodingEnabled: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.long_term_retention_check_in_question_2_headline"),
              required: false,
              placeholder: t("templates.long_term_retention_check_in_question_2_placeholder"),
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              shuffleOption: "none",
              choices: [
                t("templates.long_term_retention_check_in_question_3_choice_1"),
                t("templates.long_term_retention_check_in_question_3_choice_2"),
                t("templates.long_term_retention_check_in_question_3_choice_3"),
                t("templates.long_term_retention_check_in_question_3_choice_4"),
                t("templates.long_term_retention_check_in_question_3_choice_5"),
              ],
              headline: t("templates.long_term_retention_check_in_question_3_headline"),
              required: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_4"),
          elements: [
            buildRatingElement({
              range: 5,
              scale: "number",
              headline: t("templates.long_term_retention_check_in_question_4_headline"),
              required: true,
              lowerLabel: t("templates.long_term_retention_check_in_question_4_lower_label"),
              upperLabel: t("templates.long_term_retention_check_in_question_4_upper_label"),
              isColorCodingEnabled: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_5"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.long_term_retention_check_in_question_5_headline"),
              required: false,
              placeholder: t("templates.long_term_retention_check_in_question_5_placeholder"),
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_6"),
          elements: [
            buildNPSElement({
              headline: t("templates.long_term_retention_check_in_question_6_headline"),
              required: false,
              lowerLabel: t("templates.long_term_retention_check_in_question_6_lower_label"),
              upperLabel: t("templates.long_term_retention_check_in_question_6_upper_label"),
              isColorCodingEnabled: false,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_7"),
          elements: [
            buildMultipleChoiceElement({
              type: TSurveyElementTypeEnum.MultipleChoiceMulti,
              shuffleOption: "none",
              choices: [
                t("templates.long_term_retention_check_in_question_7_choice_1"),
                t("templates.long_term_retention_check_in_question_7_choice_2"),
                t("templates.long_term_retention_check_in_question_7_choice_3"),
                t("templates.long_term_retention_check_in_question_7_choice_4"),
                t("templates.long_term_retention_check_in_question_7_choice_5"),
              ],
              headline: t("templates.long_term_retention_check_in_question_7_headline"),
              required: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_8"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.long_term_retention_check_in_question_8_headline"),
              required: false,
              placeholder: t("templates.long_term_retention_check_in_question_8_placeholder"),
              inputType: "text",
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_9"),
          elements: [
            buildCsatElement({
              scale: "smiley",
              headline: t("templates.long_term_retention_check_in_question_9_headline"),
              required: true,
              lowerLabel: t("templates.long_term_retention_check_in_question_9_lower_label"),
              upperLabel: t("templates.long_term_retention_check_in_question_9_upper_label"),
              isColorCodingEnabled: true,
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_10"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.long_term_retention_check_in_question_10_headline"),
              required: false,
              placeholder: t("templates.long_term_retention_check_in_question_10_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const professionalDevelopmentGrowth = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "professional-development-growth",
      name: t("templates.professional_development_growth_survey_name"),
      role: "peopleManager",
      industries: ["saas", "eCommerce", "other"],
      channels: ["link"],
      description: t("templates.professional_development_growth_survey_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              headline: t("templates.professional_development_growth_survey_question_1_headline"),
              required: true,
              scale: "number",
              range: 10,
              lowerLabel: t("templates.professional_development_growth_survey_question_1_lower_label"),
              upperLabel: t("templates.professional_development_growth_survey_question_1_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildRatingElement({
              headline: t("templates.professional_development_growth_survey_question_2_headline"),
              required: true,
              scale: "number",
              range: 10,
              lowerLabel: t("templates.professional_development_growth_survey_question_2_lower_label"),
              upperLabel: t("templates.professional_development_growth_survey_question_2_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildRatingElement({
              headline: t("templates.professional_development_growth_survey_question_3_headline"),
              required: true,
              scale: "number",
              range: 10,
              lowerLabel: t("templates.professional_development_growth_survey_question_3_lower_label"),
              upperLabel: t("templates.professional_development_growth_survey_question_3_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_4"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.professional_development_growth_survey_question_4_headline"),
              required: false,
              placeholder: t("templates.professional_development_growth_survey_question_4_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const recognitionAndReward = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "recognition-and-reward",
      name: t("templates.recognition_and_reward_survey_name"),
      role: "peopleManager",
      industries: ["saas", "eCommerce", "other"],
      channels: ["link"],
      description: t("templates.recognition_and_reward_survey_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              headline: t("templates.recognition_and_reward_survey_question_1_headline"),
              required: true,
              scale: "number",
              range: 10,
              lowerLabel: t("templates.recognition_and_reward_survey_question_1_lower_label"),
              upperLabel: t("templates.recognition_and_reward_survey_question_1_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildRatingElement({
              headline: t("templates.recognition_and_reward_survey_question_2_headline"),
              required: true,
              scale: "number",
              range: 10,
              lowerLabel: t("templates.recognition_and_reward_survey_question_2_lower_label"),
              upperLabel: t("templates.recognition_and_reward_survey_question_2_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildRatingElement({
              headline: t("templates.recognition_and_reward_survey_question_3_headline"),
              required: true,
              scale: "number",
              range: 10,
              lowerLabel: t("templates.recognition_and_reward_survey_question_3_lower_label"),
              upperLabel: t("templates.recognition_and_reward_survey_question_3_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_4"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.recognition_and_reward_survey_question_4_headline"),
              required: false,
              placeholder: t("templates.recognition_and_reward_survey_question_4_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const alignmentAndEngagement = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "alignment-and-engagement",
      name: t("templates.alignment_and_engagement_survey_name"),
      role: "peopleManager",
      industries: ["saas", "eCommerce", "other"],
      channels: ["link"],
      description: t("templates.alignment_and_engagement_survey_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              headline: t("templates.alignment_and_engagement_survey_question_1_headline"),
              required: true,
              scale: "number",
              range: 10,
              lowerLabel: t("templates.alignment_and_engagement_survey_question_1_lower_label"),
              upperLabel: t("templates.alignment_and_engagement_survey_question_1_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildRatingElement({
              headline: t("templates.alignment_and_engagement_survey_question_2_headline"),
              required: true,
              scale: "number",
              range: 10,
              lowerLabel: t("templates.alignment_and_engagement_survey_question_2_lower_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildRatingElement({
              headline: t("templates.alignment_and_engagement_survey_question_3_headline"),
              required: true,
              scale: "number",
              range: 10,
              lowerLabel: t("templates.alignment_and_engagement_survey_question_3_lower_label"),
              upperLabel: t("templates.alignment_and_engagement_survey_question_3_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_4"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.alignment_and_engagement_survey_question_4_headline"),
              required: false,
              placeholder: t("templates.alignment_and_engagement_survey_question_4_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const supportiveWorkCulture = (t: TFunction): TTemplate => {
  const localSurvey = getDefaultSurveyPreset(t);
  return buildSurvey(
    {
      id: "supportive-work-culture",
      name: t("templates.supportive_work_culture_survey_name"),
      role: "peopleManager",
      industries: ["saas", "eCommerce", "other"],
      channels: ["link"],
      description: t("templates.supportive_work_culture_survey_description"),
      endings: localSurvey.endings,
      hiddenFields: hiddenFieldsDefault,
      blocks: [
        buildBlock({
          name: t("templates.block_1"),
          elements: [
            buildRatingElement({
              headline: t("templates.supportive_work_culture_survey_question_1_headline"),
              required: true,
              scale: "number",
              range: 10,
              lowerLabel: t("templates.supportive_work_culture_survey_question_1_lower_label"),
              upperLabel: t("templates.supportive_work_culture_survey_question_1_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_2"),
          elements: [
            buildRatingElement({
              headline: t("templates.supportive_work_culture_survey_question_2_headline"),
              required: true,
              scale: "number",
              range: 10,
              lowerLabel: t("templates.supportive_work_culture_survey_question_2_lower_label"),
              upperLabel: t("templates.supportive_work_culture_survey_question_2_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_3"),
          elements: [
            buildRatingElement({
              headline: t("templates.supportive_work_culture_survey_question_3_headline"),
              required: true,
              scale: "number",
              range: 10,
              lowerLabel: t("templates.supportive_work_culture_survey_question_3_lower_label"),
              upperLabel: t("templates.supportive_work_culture_survey_question_3_upper_label"),
            }),
          ],
          t,
        }),
        buildBlock({
          name: t("templates.block_4"),
          elements: [
            buildOpenTextElement({
              headline: t("templates.supportive_work_culture_survey_question_4_headline"),
              required: false,
              placeholder: t("templates.supportive_work_culture_survey_question_4_placeholder"),
              inputType: "text",
            }),
          ],
          buttonLabel: t("templates.finish"),
          t,
        }),
      ],
    },
    t
  );
};

const catalogTemplates = (t: TFunction): TTemplate[] => [
  cartAbandonmentSurvey(t),
  siteAbandonmentSurvey(t),
  productMarketFitSuperhuman(t),
  onboardingSegmentation(t),
  churnSurvey(t),
  earnedAdvocacyScore(t),
  usabilityScoreRatingSurvey(t),
  improveTrialConversion(t),
  reviewPrompt(t),
  interviewPrompt(t),
  improveActivationRate(t),
  uncoverStrengthsAndWeaknesses(t),
  productMarketFitShort(t),
  marketAttribution(t),
  changingSubscriptionExperience(t),
  identifyCustomerGoals(t),
  featureChaser(t),
  fakeDoorFollowUp(t),
  feedbackBox(t),
  integrationSetupSurvey(t),
  newIntegrationSurvey(t),
  docsFeedback(t),
  nps(t),
  starRatingSurvey(t),
  customerSatisfactionScore(t),
  customerEffortScore(t),
  smileysSurvey(t),
  enpsSurvey(t),
  collectFeedback(t),
  identifyUpsellOpportunities(t),
  prioritizeFeatures(t),
  gaugeFeatureSatisfaction(t),
  marketSiteClarity(t),
  rateCheckoutExperience(t),
  measureSearchExperience(t),
  evaluateContentQuality(t),
  measureTaskAccomplishment(t),
  identifySignUpBarriers(t),
  buildProductRoadmap(t),
  understandPurchaseIntention(t),
  improveNewsletterContent(t),
  evaluateAProductIdea(t),
  understandLowEngagement(t),
  employeeSatisfaction(t),
  employeeWellBeing(t),
  longTermRetentionCheckIn(t),
  supportiveWorkCulture(t),
  alignmentAndEngagement(t),
  recognitionAndReward(t),
  professionalDevelopmentGrowth(t),
  professionalDevelopmentSurvey(t),
  careerDevelopmentSurvey(t),
];

const buildCustomSurveyTemplate = (t: TFunction): TTemplate => {
  return {
    id: CUSTOM_SURVEY_TEMPLATE_ID,
    name: t("templates.custom_survey_name"),
    description: t("templates.custom_survey_description"),
    preset: {
      ...getDefaultSurveyPreset(t),
      name: t("templates.custom_survey_name"),
      blocks: [
        {
          id: createId(),
          name: t("templates.block_1"),
          elements: [
            {
              id: createId(),
              type: TSurveyElementTypeEnum.OpenText,
              headline: createI18nString(t("templates.custom_survey_question_1_headline"), []),
              placeholder: createI18nString(t("templates.custom_survey_question_1_placeholder"), []),
              required: true,
              inputType: "text",
              charLimit: {
                enabled: false,
              },
            },
          ],
          // Button labels at block level with default key for i18n support
          buttonLabel: createI18nString(t("templates.next"), []),
        },
      ],
    },
  };
};

export const templates = (t: TFunction): TTemplate[] => catalogTemplates(t).map(withTemplateCodes);

export const customSurveyTemplate = (t: TFunction): TTemplate =>
  withTemplateCodes(buildCustomSurveyTemplate(t));

export const getTemplateById = (templateId: string, t: TFunction): TTemplate | null => {
  if (templateId === CUSTOM_SURVEY_TEMPLATE_ID) {
    return customSurveyTemplate(t);
  }

  return templates(t).find((template) => template.id === templateId) ?? null;
};

export const previewSurvey = (workspaceName: string, t: TFunction): TSurvey => {
  return {
    id: "cltxxaa6x0000g8hacxdxejeu",
    createdAt: new Date(),
    updatedAt: new Date(),
    name: t("templates.preview_survey_name"),
    type: "link" as const,
    workspaceId: "cmnh38nzx00003b6r3svd9pv2",
    createdBy: "cltwumfbz0000echxysz6ptvq",
    status: "inProgress" as const,
    visibility: "workspace" as const,
    ownerId: null,
    visibilityVersion: 0,
    visibilityProjectedVersion: 0,
    visibilityChangedAt: null,
    visibilityChangedById: null,
    publishOn: null,
    closeOn: null,
    welcomeCard: {
      enabled: false,
      headline: createI18nString(t("templates.preview_survey_welcome_card_headline"), []),
      timeToFinish: false,
      showResponseCount: false,
    },
    styling: null,
    segment: null,
    blocks: [
      {
        id: "cltxxaa6x0000g8hacxdxeje1",
        name: t("templates.block_1"),
        elements: [
          {
            ...buildMultipleChoiceElement({
              id: "rjpu42ps6dzirsn9ds6eydgt",
              type: TSurveyElementTypeEnum.MultipleChoiceSingle,
              choiceIds: ["x6wty2s72v7vd538aadpurqx", "fbcj4530t2n357ymjp2h28d6"],
              choices: [
                t("templates.preview_survey_question_2_choice_1_label"),
                t("templates.preview_survey_question_2_choice_2_label"),
              ],
              headline: t("templates.preview_survey_question_2_headline"),
              subheader: t("templates.preview_survey_question_2_subheader"),
              required: true,
              shuffleOption: "none",
            }),
            isDraft: true,
          },
          {
            ...buildOpenTextElement({
              id: "preview-open-text-01",
              headline: t("templates.preview_survey_question_open_text_headline"),
              subheader: t("templates.preview_survey_question_open_text_subheader"),
              placeholder: t("templates.preview_survey_question_open_text_placeholder"),
              inputType: "text",
              required: false,
            }),
            isDraft: true,
          },
        ],
        buttonLabel: createI18nString(t("templates.next"), []),
        backButtonLabel: createI18nString(t("templates.preview_survey_question_2_back_button_label"), []),
      },
      {
        id: "cltxxaa6x0000g8hacxdxeje2",
        name: t("templates.block_2"),
        elements: [
          {
            ...buildRatingElement({
              id: "lbdxozwikh838yc6a8vbwuju",
              range: 5,
              scale: "star",
              headline: t("templates.preview_survey_question_1_headline", { workspaceName }),
              required: true,
              subheader: t("templates.preview_survey_question_1_subheader"),
              lowerLabel: t("templates.preview_survey_question_1_lower_label"),
              upperLabel: t("templates.preview_survey_question_1_upper_label"),
            }),
            isDraft: true,
          },
        ],
        buttonLabel: createI18nString(t("templates.next"), []),
        backButtonLabel: createI18nString(t("templates.preview_survey_question_2_back_button_label"), []),
      },
    ],
    endings: [
      {
        id: "cltyqp5ng000108l9dmxw6nde",
        type: "endScreen",
        headline: createI18nString(t("templates.preview_survey_ending_card_headline"), []),
        subheader: createI18nString(t("templates.preview_survey_ending_card_description"), []),
      },
    ],
    hiddenFields: {
      enabled: true,
      fieldIds: [],
    },
    variables: [],
    displayOption: "displayOnce",
    recontactDays: null,
    displayLimit: null,
    autoClose: null,
    recaptcha: null,
    delay: 0,
    displayPercentage: null,
    autoComplete: 50,
    isVerifyEmailEnabled: false,
    workspaceOverwrites: null,
    surveyClosedMessage: null,
    singleUse: {
      enabled: false,
      isEncrypted: true,
    },
    pin: null,
    languages: [],
    triggers: [],
    showLanguageSwitch: false,
    autoSelectLanguage: false,
    followUps: [],
    isBackButtonHidden: false,
    isAutoProgressingEnabled: true,
    isCaptureIpEnabled: false,
    isAnonymizeResponsesEnabled: false,
    metadata: {},
    questions: [], // Required for build-time type checking (Zod defaults to [] at runtime)
    slug: null,
  };
};
