import { ComponentConfig } from '@puckeditor/core';
import FAQSection, { FAQProps } from '../sections/faq-section';

export const FAQBlock: ComponentConfig<{
  props: FAQProps;
  fields: {
    userField: {
      type: 'userField';
      option: boolean;
    };
  };
}> = {
  label: 'FAQ',
  fields: {
    subTitle: { type: 'text', label: 'Sub Title' },
    title: { type: 'text', label: 'Title' },
    description: { type: 'textarea', label: 'Description' },
    items: {
      type: 'array',
      label: 'FAQ Items',
      getItemSummary: (item) => item.trigger || 'Question',
      arrayFields: {
        value: { type: 'text', label: 'Value (unique id)' },
        trigger: { type: 'text', label: 'Question' },
        content: { type: 'textarea', label: 'Answer' },
      },
      defaultItemProps: {
        value: 'item-1',
        trigger: 'How do I reset my password?',
        content:
          "Click on 'Forgot Password' on the login page, enter your email address, and we'll send you a link to reset your password. The link will expire in 24 hours.",
      },
    },
  },
  defaultProps: {
    subTitle: 'FAQ',
    title: 'Frequently Asked Questions',
    description:
      'Access diversified investment strategies managed by algorithmic trading and market experts.',
    items: [
      {
        value: 'item-1',
        trigger: 'How do I reset my password?',
        content:
          "Click on 'Forgot Password' on the login page, enter your email address, and we'll send you a link to reset your password. The link will expire in 24 hours.",
      },
      {
        value: 'item-2',
        trigger: 'Can I change my subscription plan?',
        content:
          'Yes, you can upgrade or downgrade your plan at any time from your account settings. Changes will be reflected in your next billing cycle.',
      },
      {
        value: 'item-3',
        trigger: 'What payment methods do you accept?',
        content:
          'We accept all major credit cards, PayPal, and bank transfers. All payments are processed securely through our payment partners.',
      },
      {
        value: 'item-4',
        trigger: 'What payment methods do you accept?',
        content:
          'We accept all major credit cards, PayPal, and bank transfers. All payments are processed securely through our payment partners.',
      },
      {
        value: 'item-5',
        trigger: 'What payment methods do you accept?',
        content:
          'We accept all major credit cards, PayPal, and bank transfers. All payments are processed securely through our payment partners.',
      },
    ],
  },
  render: FAQSection,
};
