import { ComponentConfig } from '@puckeditor/core';
import DashboardFooterSection, {
  DashboardFooterSectionProps,
} from '../sections/dashboard-footer-section';

export const DashboardFooterBlock: ComponentConfig<DashboardFooterSectionProps> =
  {
    label: 'Footer',
    fields: {
      description: { type: 'textarea', label: 'Description' },
      copyright: { type: 'text', label: 'Copyright' },
      socialLinks: {
        type: 'array',
        label: 'Social Links',
        min: 0,
        max: 8,
        getItemSummary: (item) => item.platform || 'Social',
        arrayFields: {
          platform: {
            type: 'select',
            label: 'Platform',
            options: [
              { label: 'X (Twitter)', value: 'x' },
              { label: 'Discord', value: 'discord' },
              { label: 'Telegram', value: 'telegram' },
              { label: 'Instagram', value: 'instagram' },
              { label: 'Github', value: 'github' },
              { label: 'YouTube', value: 'youtube' },
            ],
          },
          href: { type: 'text', label: 'URL' },
        },
        defaultItemProps: { platform: 'x', href: '#' },
      },
      links: {
        type: 'array',
        label: 'Links',
        min: 0,
        max: 12,
        getItemSummary: (item) => item.label || 'Link',
        arrayFields: {
          label: { type: 'text', label: 'Label' },
          href: { type: 'text', label: 'URL' },
        },
        defaultItemProps: { label: 'Link', href: '#' },
      },
      policyLinks: {
        type: 'array',
        label: 'Policy Links',
        min: 0,
        max: 6,
        getItemSummary: (item) => item.label || 'Policy',
        arrayFields: {
          label: { type: 'text', label: 'Label' },
          href: { type: 'text', label: 'URL' },
        },
        defaultItemProps: { label: 'Privacy Policy', href: '/privacy-policy' },
      },
    },
    defaultProps: {
      description:
        "The world's largest prediction market. Trade on the outcomes of real-world events.",
      copyright: `© ${new Date().getFullYear()} Platform. All rights reserved.`,
      socialLinks: [
        { platform: 'x', href: '#' },
        { platform: 'discord', href: '#' },
        { platform: 'telegram', href: '#' },
      ],
      links: [
        { label: 'Markets', href: '/markets' },
        { label: 'Portfolio', href: '/portfolio' },
        { label: 'Watchlist', href: '/markets?watchlist=1' },
        { label: 'Leaderboard', href: '/leaderboard' },
        { label: 'Support', href: '/support-ticket' },
        { label: 'Referrals', href: '/referrals' },
      ],
      policyLinks: [{ label: 'Privacy Policy', href: '/privacy-policy' }],
    },
    render: DashboardFooterSection,
  };
