// Mock data for email templates to use in React Email preview server
import { TOrganization } from "@formbricks/types/organizations";
import { TResponse } from "@formbricks/types/responses";
import { TSurveyElementTypeEnum } from "@formbricks/types/surveys/elements";
import { TSurvey } from "@formbricks/types/surveys/types";
import { embedSurveyPreviewEmailHtml } from "./fixtures/embed-survey-preview-email-html";

export const exampleData = {
  verificationEmail: {
    verifyLink: "https://app.formbricks.com/auth/verify?token=example-verification-token",
    verificationRequestLink: "https://app.formbricks.com/auth/verification-requested",
  },

  forgotPasswordEmail: {
    verifyLink: "https://app.formbricks.com/auth/forgot-password/reset?token=example-reset-token",
    linkValidityInMinutes: 30,
  },

  deleteAccountEmail: {
    deleteLink:
      "https://app.formbricks.com/api/auth/delete-user/callback?token=example-delete-token&callbackURL=/",
    linkValidityInMinutes: 60,
  },

  newEmailVerification: {
    verifyLink: "https://app.formbricks.com/verify-email-change?token=example-email-change-token",
  },

  passwordResetNotifyEmail: {
    // No props needed
  },

  accountDeletedEmail: {
    // No props needed
  },

  ssoRecoveryFactorsRemovedEmail: {
    passwordRemoved: true,
    twoFactorRemoved: true,
    apiKeysRemoved: true,
    securitySettingsLink: "https://app.formbricks.com/account/settings/profile",
  },

  attachmentExportReadyEmail: {
    surveyName: "Mystery shopper visit",
    archiveSize: "5.7 GB",
    fileCount: "4,812",
    includedFileCount: "4,812",
    sizeLimit: "5 GB",
    retentionMonths: "3",
    expiryDate: "February 3, 2027",
    truncated: false,
    downloadLink: "https://app.formbricks.com/attachment-exports/cm8cmpnjj000108jfdr9exp01",
  },

  attachmentExportFailedEmail: {
    surveyName: "Mystery shopper visit",
    reason: "build_timeout" as const,
    maxFiles: "5,000",
    responsesLink: "https://app.formbricks.com/workspaces/ws/surveys/survey/responses",
  },

  memberRetentionNoticeEmail: {
    organizationName: "Acme",
    deactivateDate: "Dec 7, 2026",
    loginLink: "https://app.formbricks.com/auth/login",
  },

  surveyRetentionNoticeEmail: {
    organizationName: "Acme",
    responseDeletions: [
      {
        name: "Customer Satisfaction Survey",
        url: "https://app.formbricks.com/workspaces/example-workspace-id/surveys/example-survey-id/summary",
        count: "1,204",
        deleteDate: "Dec 7, 2026",
      },
    ],
    archivedSurveys: [
      {
        name: "Website Feedback 2023",
        url: "https://app.formbricks.com/workspaces/example-workspace-id/surveys/example-survey-id-2/summary",
        archiveDate: "Dec 7, 2026",
        deleteDate: "Jan 6, 2027",
      },
    ],
    settingsLink:
      "https://app.formbricks.com/organizations/example-organization-id/settings/data-retention/exemptions",
  },

  ssoSignInHintEmail: {
    providerNames: ["Microsoft"],
    loginLink: "https://app.formbricks.com/auth/login",
  },

  inviteEmail: {
    inviteeName: "Jane Smith",
    inviterName: "John Doe",
    verifyLink: "https://app.formbricks.com/invite?token=example-invite-token",
  },

  inviteAcceptedEmail: {
    inviterName: "John Doe",
    inviteeName: "Jane Smith",
  },

  linkSurveyEmail: {
    surveyName: "Customer Satisfaction Survey",
    surveyLink:
      "https://app.formbricks.com/s/example-survey-id?verify=example-token&suId=example-single-use-id",
  },

  embedSurveyPreviewEmail: {
    html: embedSurveyPreviewEmailHtml,
    workspaceId: "workspace-123",
  },

  responseFinishedEmail: {
    survey: {
      id: "survey-123",
      name: "Customer Feedback Survey",
      variables: [
        {
          id: "var-1",
          name: "Customer ID",
          type: "text" as const,
        },
      ],
      hiddenFields: {
        enabled: true,
        fieldIds: ["userId"],
      },
      welcomeCard: {
        enabled: false,
      },
      questions: [
        {
          id: "q1",
          type: "openText" as const,
          headline: { default: "What did you like most?" },
          required: true,
          inputType: "text" as const,
        },
        {
          id: "q2",
          type: "rating" as const,
          headline: { default: "How would you rate your experience?" },
          required: true,
          scale: "number" as const,
          range: 5,
        },
      ],
      endings: [],
      styling: {},
      createdBy: null,
    } as unknown as TSurvey,
    responseCount: 15,
    response: {
      id: "response-123",
      createdAt: new Date(),
      updatedAt: new Date(),
      surveyId: "survey-123",
      finished: true,
      data: {
        q1: "The customer service was excellent!",
        q2: 5,
        userId: "user-abc-123",
      },
      variables: {
        "var-1": "CUST-456",
      },
      contactAttributes: {
        email: "customer@example.com",
      },
      meta: {
        userAgent: {},
        url: "https://example.com",
      },
      tags: [],
      ttc: {},
      singleUseId: null,
      language: "default",
      displayId: null,
    } as unknown as TResponse,
    WEBAPP_URL: "https://app.formbricks.com",
    workspaceId: "workspace-123",
    organization: {
      id: "org-123",
      name: "Acme Corporation",
      createdAt: new Date(),
      updatedAt: new Date(),
      billing: {
        stripeCustomerId: null,
        subscriptionStatus: null,
        features: {
          inAppSurvey: { status: "active" as const, unlimited: true },
          linkSurvey: { status: "active" as const, unlimited: true },
          userTargeting: { status: "active" as const, unlimited: true },
        },
        limits: {
          monthly: {
            responses: 1000,
          },
        },
      },
      isAISmartToolsEnabled: false,
    } as unknown as TOrganization,
  },

  followUpEmail: {
    body: "<p>Thank you for your feedback! We've received your response and will review it shortly.</p><p>Here's a summary of what you submitted:</p>",
    responseData: [
      {
        element: "What did you like most?",
        response: "The customer service was excellent!",
        type: TSurveyElementTypeEnum.OpenText,
      },
      {
        element: "How would you rate your experience?",
        response: "5",
        type: TSurveyElementTypeEnum.Rating,
      },
    ],
    variables: [
      {
        id: "var-1",
        name: "Customer ID",
        type: "text" as const,
        value: "CUST-456",
      },
    ],
    hiddenFields: [
      {
        id: "user_id",
        name: "User ID",
        value: "user-abc-123",
      },
    ],
  },

  emailCustomizationPreviewEmail: {
    userName: "Alex Johnson",
  },

  legalProps: {
    privacyUrl: "https://formbricks.com/privacy",
    termsUrl: "https://formbricks.com/terms",
    imprintUrl: "https://formbricks.com/imprint",
    imprintAddress: "Formbricks GmbH, Example Street 123, 12345 Berlin, Germany",
  },
};

export type ExampleDataKeys = keyof typeof exampleData;
export type ExampleData<K extends ExampleDataKeys> = (typeof exampleData)[K];
