/**
 * Keyword Form Configuration
 * Field definitions for Add/Edit Keyword modal
 */

import { FormField } from '../../components/common/FormModal';

export interface KeywordFormConfig {
  fields: FormField[];
}

/**
 * Get keyword form fields configuration
 * Can be customized with dynamic options (e.g., clusters)
 */
export const getKeywordFormConfig = (options?: {
  clusters?: Array<{ id: number; name: string }>;
}): FormField[] => {
  const clusterOptions = options?.clusters
    ? [
        { value: '', label: 'No Cluster' },
        ...options.clusters.map((c) => ({
          value: c.id.toString(),
          label: c.name,
        })),
      ]
    : [{ value: '', label: 'No Cluster' }];

  return [
    {
      key: 'keyword',
      label: 'Keyword',
      type: 'text',
      placeholder: 'Enter keyword',
      value: '',
      onChange: () => {},
      required: true,
    },
    {
      key: 'volume',
      label: 'Volume',
      type: 'number',
      value: 0,
      onChange: () => {},
      required: false,
    },
    {
      key: 'difficulty',
      label: 'Difficulty',
      type: 'number',
      value: 0,
      onChange: () => {},
      min: 1,
      max: 5,
      required: false,
    },
    {
      key: 'country',
      label: 'Country',
      type: 'select',
      value: 'US',
      onChange: () => {},
      options: [
        { value: 'US', label: 'United States' },
        { value: 'CA', label: 'Canada' },
        { value: 'GB', label: 'United Kingdom' },
        { value: 'AE', label: 'United Arab Emirates' },
        { value: 'AU', label: 'Australia' },
        { value: 'IN', label: 'India' },
        { value: 'PK', label: 'Pakistan' },
      ],
      required: false,
    },
    {
      key: 'cluster_id',
      label: 'Cluster',
      type: 'select',
      value: '',
      onChange: () => {},
      options: clusterOptions,
      required: false,
    },
    {
      key: 'status',
      label: 'Status',
      type: 'select',
      value: 'pending',
      onChange: () => {},
      options: [
        { value: 'pending', label: 'Pending' },
        { value: 'active', label: 'Active' },
        { value: 'archived', label: 'Archived' },
      ],
      required: false,
    },
  ];
};

