<?php
/**
 * ==========================
 * 🔐 IGNY8 FILE RULE HEADER
 * ==========================
 * @file         : tables-config.php
 * @location     : /modules/config/tables-config.php
 * @type         : Config Array
 * @scope        : Global
 * @allowed      : Table definitions, column structures, configuration data
 * @reusability  : Globally Reusable
 * @notes        : Central table configuration for all modules
 */

// Prevent direct access only if not being included
if (!defined('ABSPATH') && !defined('IGNY8_INCLUDE_CONFIG')) {
    exit;
}

return [
    // Keywords Table
    'planner_keywords' => [
        'table' => 'igny8_keywords',
        'title' => 'Keywords Management',
        'humanize_columns' => ['keyword', 'search_volume', 'difficulty', 'cpc', 'intent', 'status', 'cluster_id'],
        'columns' => [
            'keyword' => [
                'label' => 'Keyword',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true
            ],
            'search_volume' => [
                'label' => 'Volume',
                'type' => 'number',
                'sortable' => true,
                'format' => 'number'
            ],
            'difficulty' => [
                'label' => 'Difficulty',
                'type' => 'number',
                'sortable' => true,
                'format' => 'difficulty_label'
            ],
            'cpc' => [
                'label' => 'CPC',
                'type' => 'number',
                'sortable' => true,
                'decimal' => true
            ],
            'intent' => [
                'label' => 'Intent',
                'type' => 'enum',
                'options' => ['informational', 'navigational', 'transactional', 'commercial'],
                'sortable' => true
            ],
            'status' => [
                'label' => 'Status',
                'type' => 'enum',
                'options' => ['unmapped', 'mapped', 'queued', 'published'],
                'sortable' => true
            ],
            'cluster_id' => [
                'label' => 'Cluster',
                'type' => 'lookup',
                'source_field' => 'cluster_id',
                'display_field' => 'cluster_name',
                'sortable' => true,
                'join_query' => 'LEFT JOIN {prefix}igny8_clusters c ON {table_name}.cluster_id = c.id',
                'select_field' => 'c.cluster_name as cluster_name'
            ]
        ],
        'pagination' => ['per_page' => 10, 'enabled' => true],
        'search_field' => 'keyword',
        'search_placeholder' => 'Search keywords...',
        'actions' => ['delete_selected', 'export_selected', 'import', 'add_new'],
        'bulk_actions' => ['delete', 'map'],
        'row_actions' => ['edit', 'delete']
    ],
    
    // Clusters Table
    'planner_clusters' => [
        'table' => 'igny8_clusters',
        'title' => 'Clusters Management',
        'humanize_columns' => ['cluster_name', 'sector_id', 'status', 'keyword_count', 'total_volume', 'avg_difficulty', 'mapped_pages_count', 'created_at'],
        'columns' => [
            'cluster_name' => [
                'label' => 'Cluster Name',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true
            ],
            'sector_id' => [
                'label' => 'Sectors',
                'type' => 'text',
                'source_field' => 'sector_id',
                'display_field' => 'sector_name',
                'sortable' => true,
                'join_query' => 'LEFT JOIN {prefix}igny8_sectors s ON {table_name}.sector_id = s.id',
                'select_field' => 's.sector_name as sector_name'
            ],
            'status' => [
                'label' => 'Status',
                'type' => 'enum',
                'options' => ['active', 'inactive', 'archived'],
                'sortable' => true
            ],
            'keyword_count' => [
                'label' => 'Keywords',
                'type' => 'number',
                'sortable' => true,
                'calculated' => false
                //'calculation_query' => 'SELECT COUNT(k.id) FROM {prefix}igny8_keywords k WHERE k.cluster_id = {table_name}.id'
            ],
            'total_volume' => [
                'label' => 'Total Volume',
                'type' => 'number',
                'sortable' => true,
                'format' => 'number'
            ],
            'avg_difficulty' => [
                'label' => 'Avg KD',
                'type' => 'number',
                'sortable' => true,
                'format' => 'difficulty_label'
            ],
            'mapped_pages_count' => [
                'label' => 'Mapped Pages',
                'type' => 'number',
                'sortable' => true,
                'calculated' => false
            ],
            'created_at' => [
                'label' => 'Created',
                'type' => 'date',
                'sortable' => true,
                'format' => 'date'
            ]
        ],
        'pagination' => ['per_page' => 10, 'enabled' => true],
        'search_field' => 'cluster_name',
        'search_placeholder' => 'Search clusters...',
        'actions' => ['delete_selected', 'export_selected', 'import', 'add_new'],
        'bulk_actions' => ['delete', 'activate', 'deactivate'],
        'row_actions' => ['edit', 'delete', 'view_keywords']
    ],
    
    // Ideas Table
    'planner_ideas' => [
        'table' => 'igny8_content_ideas',
        'title' => 'Content Ideas Management',
        'humanize_columns' => ['idea_title', 'content_structure', 'content_type', 'target_keywords', 'keyword_cluster_id', 'status', 'estimated_word_count', 'created_at'],
        'columns' => [
            'idea_title' => [
                'label' => 'Title',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true
            ],
            'content_structure' => [
                'label' => 'Structure',
                'type' => 'enum',
                'options' => ['cluster_hub', 'landing_page', 'guide_tutorial', 'how_to', 'comparison', 'review', 'top_listicle', 'question', 'product_description', 'service_page', 'home_page'],
                'sortable' => true
            ],
            'content_type' => [
                'label' => 'Type',
                'type' => 'enum',
                'options' => ['post', 'product', 'page', 'CPT'],
                'sortable' => true
            ],
            'target_keywords' => [
                'label' => 'Target Keywords',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true
            ],
            'keyword_cluster_id' => [
                'label' => 'Cluster',
                'type' => 'lookup',
                'source_field' => 'keyword_cluster_id',
                'display_field' => 'cluster_name',
                'sortable' => true,
                'join_query' => 'LEFT JOIN {prefix}igny8_clusters c ON {table_name}.keyword_cluster_id = c.id',
                'select_field' => 'c.cluster_name as cluster_name'
            ],
            'status' => [
                'label' => 'Status',
                'type' => 'enum',
                'options' => ['new', 'scheduled', 'published'],
                'sortable' => true
            ],
            'estimated_word_count' => [
                'label' => 'Words',
                'type' => 'number',
                'sortable' => true
            ],
            'created_at' => [
                'label' => 'Created',
                'type' => 'date',
                'sortable' => true,
                'format' => 'date'
            ]
        ],
        'pagination' => ['per_page' => 10, 'enabled' => true],
        'search_field' => 'idea_title',
        'search_placeholder' => 'Search ideas...',
        'actions' => ['delete_selected', 'export_selected', 'import', 'add_new'],
        'bulk_actions' => ['delete', 'change_status', 'bulk_queue_to_writer'],
        'row_actions' => ['edit', 'delete', 'create_draft', 'queue_to_writer']
    ],
    
    
    // Writer Tasks Table (Content Queue / Tasks)
    'writer_tasks' => [
        'table' => 'igny8_tasks',
        'title' => 'Content Queue / Tasks',
        'humanize_columns' => ['title', 'cluster_id', 'keywords', 'word_count', 'status', 'content_structure', 'content_type', 'created_at'],
        'default_filter' => [
            'status' => ['queued', 'in_progress']
        ],
        'columns' => [
            'title' => [
                'label' => 'Task Title',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true
            ],
            'cluster_id' => [
                'label' => 'Cluster Name',
                'type' => 'lookup',
                'source_field' => 'cluster_id',
                'display_field' => 'cluster_name',
                'sortable' => true,
                'join_query' => 'LEFT JOIN {prefix}igny8_clusters c ON {table_name}.cluster_id = c.id',
                'select_field' => 'c.cluster_name as cluster_name'
            ],
            'keywords' => [
                'label' => 'Keywords',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true
            ],
            'word_count' => [
                'label' => 'Word Count',
                'type' => 'number',
                'sortable' => true,
                'format' => 'number'
            ],
            'status' => [
                'label' => 'Status',
                'type' => 'enum',
                'sortable' => true,
                'options' => ['queued', 'in_progress', 'completed', 'cancelled', 'draft', 'review', 'published']
            ],
            'content_structure' => [
                'label' => 'Structure',
                'type' => 'enum',
                'sortable' => true,
                'options' => ['cluster_hub', 'landing_page', 'guide_tutorial', 'how_to', 'comparison', 'review', 'top_listicle', 'question', 'product_description', 'service_page', 'home_page']
            ],
            'content_type' => [
                'label' => 'Type',
                'type' => 'enum',
                'sortable' => true,
                'options' => ['post', 'product', 'page', 'CPT']
            ],
            'created_at' => [
                'label' => 'Created',
                'type' => 'datetime',
                'sortable' => true,
                'format' => 'time_ago_created'
            ]
        ],
        'pagination' => ['per_page' => 20, 'enabled' => true],
        'search_field' => 'title',
        'search_placeholder' => 'Search tasks...',
        'filters' => [
            'status' => [
                'label' => 'Status',
                'type' => 'select',
                'options' => ['queued', 'in_progress']
            ],
            'priority' => [
                'label' => 'Priority',
                'type' => 'select',
                'options' => ['urgent', 'high', 'medium', 'low']
            ],
            'content_structure' => [
                'label' => 'Content Structure',
                'type' => 'select',
                'options' => ['cluster_hub', 'landing_page', 'guide_tutorial', 'how_to', 'comparison', 'review', 'top_listicle', 'question', 'product_description', 'service_page', 'home_page']
            ],
            'content_type' => [
                'label' => 'Content Type',
                'type' => 'select',
                'options' => ['post', 'product', 'page', 'CPT']
            ],
            'cluster_id' => [
                'label' => 'Cluster',
                'type' => 'select',
                'options' => 'dynamic_clusters'
            ]
        ],
        'actions' => ['delete_selected', 'export_selected', 'add_new'],
        'bulk_actions' => ['delete', 'mark_in_progress', 'move_to_drafts'],
        'row_actions' => ['edit', 'delete']
    ],

    // Writer Drafts Table (Content Generated)
    'writer_drafts' => [
        'table' => 'igny8_tasks',
        'title' => 'Content Generated',
        'humanize_columns' => ['title', 'cluster_id', 'status', 'content_structure', 'content_type', 'meta_title', 'meta_description', 'keywords', 'word_count', 'updated_at'],
        'default_filter' => [
            'status' => ['draft', 'review']
        ],
        'columns' => [
            'title' => [
                'label' => 'Title',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true
            ],
            'cluster_id' => [
                'label' => 'Cluster',
                'type' => 'lookup',
                'source_field' => 'cluster_id',
                'display_field' => 'cluster_name',
                'sortable' => true,
                'join_query' => 'LEFT JOIN {prefix}igny8_clusters c ON {table_name}.cluster_id = c.id',
                'select_field' => 'c.cluster_name as cluster_name'
            ],
            'status' => [
                'label' => 'Status',
                'type' => 'enum',
                'sortable' => true,
                'options' => ['draft', 'review']
            ],
            'content_structure' => [
                'label' => 'Structure',
                'type' => 'enum',
                'sortable' => true,
                'options' => ['cluster_hub', 'landing_page', 'guide_tutorial', 'how_to', 'comparison', 'review', 'top_listicle', 'question', 'product_description', 'service_page', 'home_page']
            ],
            'content_type' => [
                'label' => 'Type',
                'type' => 'enum',
                'sortable' => true,
                'options' => ['post', 'product', 'page', 'CPT']
            ],
            'meta_title' => [
                'label' => 'Meta Title',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true
            ],
            'meta_description' => [
                'label' => 'Meta Description',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true
            ],
            'keywords' => [
                'label' => 'Keywords',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true
            ],
            'word_count' => [
                'label' => 'Word Count',
                'type' => 'number',
                'sortable' => true
            ],
            'updated_at' => [
                'label' => 'Updated',
                'type' => 'datetime',
                'sortable' => true,
                'format' => 'time_ago_updated'
            ]
        ],
        'pagination' => ['per_page' => 20, 'enabled' => true],
        'search_field' => 'title',
        'search_placeholder' => 'Search drafts...',
        'filters' => [
            'status' => [
                'label' => 'Status',
                'type' => 'select',
                'options' => ['draft', 'review']
            ],
            'content_structure' => [
                'label' => 'Content Structure',
                'type' => 'select',
                'options' => ['cluster_hub', 'landing_page', 'guide_tutorial', 'how_to', 'comparison', 'review', 'top_listicle', 'question', 'product_description', 'service_page', 'home_page']
            ],
            'content_type' => [
                'label' => 'Content Type',
                'type' => 'select',
                'options' => ['post', 'product', 'page', 'CPT']
            ],
            'cluster_id' => [
                'label' => 'Cluster',
                'type' => 'select',
                'options' => 'dynamic_clusters'
            ]
        ],
        'actions' => ['delete_selected', 'publish_selected', 'export_selected', 'add_new'],
        'bulk_actions' => ['delete', 'move_to_queue', 'publish'],
        'row_actions' => ['edit', 'publish', 'delete']
    ],
    
    // Writer Published Table (Live Content)
    'writer_published' => [
        'table' => 'igny8_tasks',
        'title' => 'Live Content',
        'humanize_columns' => ['title', 'status', 'cluster_id', 'content_structure', 'content_type', 'meta_title', 'meta_description', 'keywords', 'word_count', 'updated_at'],
        'default_filter' => [
            'status' => ['published']
        ],
        'columns' => [
            'title' => [
                'label' => 'Title',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true
            ],
            'status' => [
                'label' => 'Status',
                'type' => 'enum',
                'sortable' => true,
                'options' => ['published']
            ],
            'cluster_id' => [
                'label' => 'Cluster',
                'type' => 'lookup',
                'source_field' => 'cluster_id',
                'display_field' => 'cluster_name',
                'sortable' => true,
                'join_query' => 'LEFT JOIN {prefix}igny8_clusters c ON {table_name}.cluster_id = c.id',
                'select_field' => 'c.cluster_name as cluster_name'
            ],
            'content_structure' => [
                'label' => 'Structure',
                'type' => 'enum',
                'sortable' => true,
                'options' => ['cluster_hub', 'landing_page', 'guide_tutorial', 'how_to', 'comparison', 'review', 'top_listicle', 'question', 'product_description', 'service_page', 'home_page']
            ],
            'content_type' => [
                'label' => 'Type',
                'type' => 'enum',
                'sortable' => true,
                'options' => ['post', 'product', 'page', 'CPT']
            ],
            'meta_title' => [
                'label' => 'Meta Title',
                'type' => 'text',
                'source_meta' => '_igny8_meta_title'
            ],
            'meta_description' => [
                'label' => 'Meta Description',
                'type' => 'text',
                'source_meta' => '_igny8_meta_description'
            ],
            'keywords' => [
                'label' => 'Keywords',
                'type' => 'text',
                'source_meta' => '_igny8_primary_keywords'
            ],
            'word_count' => [
                'label' => 'Word Count',
                'type' => 'number',
                'source_meta' => '_igny8_word_count',
                'sortable' => true
            ],
            'updated_at' => [
                'label' => 'Updated',
                'type' => 'datetime',
                'sortable' => true,
                'format' => 'time_ago_updated'
            ]
        ],
        'pagination' => ['per_page' => 20, 'enabled' => true],
        'search_field' => 'title',
        'search_placeholder' => 'Search published content...',
        'filters' => [
            'status' => [
                'label' => 'Status',
                'type' => 'select',
                'options' => ['published']
            ],
            'content_structure' => [
                'label' => 'Content Structure',
                'type' => 'select',
                'options' => ['cluster_hub', 'landing_page', 'guide_tutorial', 'how_to', 'comparison', 'review', 'top_listicle', 'question', 'product_description', 'service_page', 'home_page']
            ],
            'content_type' => [
                'label' => 'Content Type',
                'type' => 'select',
                'options' => ['post', 'product', 'page', 'CPT']
            ],
            'cluster_id' => [
                'label' => 'Cluster',
                'type' => 'select',
                'options' => 'dynamic_clusters'
            ],
            'created_at' => [
                'label' => 'Date Range',
                'type' => 'date_range',
                'field' => 'created_at'
            ]
        ],
        'actions' => ['delete_selected', 'export_selected', 'add_new'],
        'bulk_actions' => ['delete', 'move_to_draft', 'unpublish'],
        'row_actions' => ['edit', 'unpublish', 'delete']
    ],
    
    // Optimizer Audits Table
    'optimizer_audits' => [
        'table' => 'igny8_audits',
        'title' => 'SEO Audits Management',
        'columns' => [
            'page_url' => [
                'label' => 'Page URL',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true,
                'format' => 'url'
            ],
            'seo_score' => [
                'label' => 'SEO Score',
                'type' => 'number',
                'sortable' => true,
                'format' => 'score'
            ],
            'audit_status' => [
                'label' => 'Status',
                'type' => 'enum',
                'options' => ['pending', 'in_progress', 'completed', 'failed'],
                'sortable' => true
            ],
            'issues_found' => [
                'label' => 'Issues',
                'type' => 'number',
                'sortable' => true
            ],
            'last_audit' => [
                'label' => 'Last Audit',
                'type' => 'date',
                'sortable' => true,
                'format' => 'datetime'
            ],
            'next_audit' => [
                'label' => 'Next Audit',
                'type' => 'date',
                'sortable' => true,
                'format' => 'date'
            ]
        ],
        'pagination' => ['per_page' => 10, 'enabled' => true],
        'search_field' => 'page_url',
        'search_placeholder' => 'Search pages...',
        'actions' => ['delete_selected', 'export_selected', 'bulk_audit'],
        'bulk_actions' => ['run_audit', 'schedule_audit'],
        'row_actions' => ['view_details', 'run_audit', 'delete']
    ],
    
    // Linker Backlinks Table
    'linker_backlinks' => [
        'table' => 'igny8_backlinks',
        'title' => 'Backlinks Management',
        'columns' => [
            'target_url' => [
                'label' => 'Target URL',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true,
                'format' => 'url'
            ],
            'source_domain' => [
                'label' => 'Source Domain',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true
            ],
            'link_type' => [
                'label' => 'Link Type',
                'type' => 'enum',
                'options' => ['dofollow', 'nofollow', 'sponsored', 'ugc'],
                'sortable' => true
            ],
            'status' => [
                'label' => 'Status',
                'type' => 'enum',
                'options' => ['active', 'lost', 'pending'],
                'sortable' => true
            ],
            'domain_authority' => [
                'label' => 'DA',
                'type' => 'number',
                'sortable' => true
            ],
            'anchor_text' => [
                'label' => 'Anchor Text',
                'type' => 'text',
                'sortable' => true
            ],
            'discovered_date' => [
                'label' => 'Discovered',
                'type' => 'date',
                'sortable' => true,
                'format' => 'date'
            ]
        ],
        'pagination' => ['per_page' => 10, 'enabled' => true],
        'search_field' => 'target_url',
        'search_placeholder' => 'Search backlinks...',
        'actions' => ['delete_selected', 'export_selected', 'recheck_links'],
        'bulk_actions' => ['recheck', 'mark_lost'],
        'row_actions' => ['edit', 'delete', 'recheck', 'view_source']
    ],
    
    // Writer Templates Table (Prompts)
    'writer_templates' => [
        'table' => 'igny8_prompts',
        'title' => 'Content Templates Management',
        'columns' => [
            'prompt_name' => [
                'label' => 'Template Name',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true,
                'source_field' => 'prompt_name',
                'editable' => true
            ],
            'category' => [
                'label' => 'Category',
                'type' => 'text',
                'sortable' => true,
                'source_field' => 'prompt_type',
                'options' => [
                    'content' => 'Blog',
                    'optimization' => 'Review',
                    'generation' => 'Product',
                    'custom' => 'Custom'
                ]
            ],
            'status' => [
                'label' => 'Status',
                'type' => 'badge',
                'sortable' => true,
                'source_field' => 'is_active',
                'options' => [
                    '1' => ['label' => 'Active', 'color' => 'green'],
                    '0' => ['label' => 'Draft', 'color' => 'gray']
                ]
            ],
            'label' => [
                'label' => 'Label',
                'type' => 'text',
                'sortable' => true,
                'source_field' => 'variables',
                'format' => 'json_extract',
                'json_path' => '$.label'
            ],
            'prompt_text' => [
                'label' => 'Prompt Body',
                'type' => 'truncated_text',
                'sortable' => false,
                'source_field' => 'prompt_text',
                'truncate_length' => 100,
                'tooltip' => true
            ],
            'created_at' => [
                'label' => 'Created',
                'type' => 'datetime',
                'sortable' => true,
                'format' => 'datetime'
            ]
        ],
        'pagination' => ['per_page' => 15, 'enabled' => true],
        'search_field' => 'prompt_name',
        'search_placeholder' => 'Search templates...',
        'actions' => ['delete_selected', 'export_selected', 'import', 'add_new'],
        'bulk_actions' => ['delete', 'activate', 'deactivate'],
        'row_actions' => ['edit', 'duplicate', 'delete']
    ],
    
    // Optimizer Suggestions Table
    'optimizer_suggestions' => [
        'table' => 'igny8_suggestions',
        'title' => 'SEO Suggestions Management',
        'columns' => [
            'page_url' => [
                'label' => 'Page URL',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true,
                'format' => 'url'
            ],
            'suggestion_type' => [
                'label' => 'Type',
                'type' => 'enum',
                'options' => ['title_optimization', 'meta_description', 'heading_structure', 'content_improvement', 'internal_linking'],
                'sortable' => true
            ],
            'priority' => [
                'label' => 'Priority',
                'type' => 'enum',
                'options' => ['high', 'medium', 'low'],
                'sortable' => true
            ],
            'status' => [
                'label' => 'Status',
                'type' => 'enum',
                'options' => ['pending', 'in_progress', 'completed', 'dismissed'],
                'sortable' => true
            ],
            'impact_score' => [
                'label' => 'Impact Score',
                'type' => 'number',
                'sortable' => true,
                'format' => 'score'
            ],
            'created_date' => [
                'label' => 'Created',
                'type' => 'date',
                'sortable' => true,
                'format' => 'date'
            ]
        ],
        'pagination' => ['per_page' => 10, 'enabled' => true],
        'search_field' => 'page_url',
        'search_placeholder' => 'Search pages...',
        'actions' => ['delete_selected', 'export_selected', 'bulk_apply'],
        'bulk_actions' => ['apply', 'dismiss', 'change_priority'],
        'row_actions' => ['view_details', 'apply', 'dismiss']
    ],
    
    // Linker Campaigns Table
    'linker_campaigns' => [
        'table' => 'igny8_campaigns',
        'title' => 'Link Building Campaigns',
        'columns' => [
            'campaign_name' => [
                'label' => 'Campaign Name',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true
            ],
            'target_url' => [
                'label' => 'Target URL',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true,
                'format' => 'url'
            ],
            'status' => [
                'label' => 'Status',
                'type' => 'enum',
                'options' => ['planning', 'active', 'paused', 'completed', 'cancelled'],
                'sortable' => true
            ],
            'links_acquired' => [
                'label' => 'Links Acquired',
                'type' => 'number',
                'sortable' => true
            ],
            'target_links' => [
                'label' => 'Target Links',
                'type' => 'number',
                'sortable' => true
            ],
            'completion_percentage' => [
                'label' => 'Completion %',
                'type' => 'number',
                'sortable' => true,
                'format' => 'percentage'
            ],
            'start_date' => [
                'label' => 'Start Date',
                'type' => 'date',
                'sortable' => true,
                'format' => 'date'
            ],
            'end_date' => [
                'label' => 'End Date',
                'type' => 'date',
                'sortable' => true,
                'format' => 'date'
            ]
        ],
        'pagination' => ['per_page' => 10, 'enabled' => true],
        'search_field' => 'campaign_name',
        'search_placeholder' => 'Search campaigns...',
        'actions' => ['delete_selected', 'export_selected', 'import', 'add_new'],
        'bulk_actions' => ['delete', 'activate', 'pause', 'complete'],
        'row_actions' => ['edit', 'delete', 'view_progress', 'duplicate']
    ],
    
    // Personalize Rewrites Table
    'personalize_rewrites' => [
        'table' => 'igny8_variations',
        'title' => 'Content Variations Management',
        'humanize_columns' => ['post_id', 'field_inputs', 'personalized_content', 'fields_hash', 'created_at'],
        'columns' => [
            'post_id' => [
                'label' => 'Post',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true,
                'join_query' => 'LEFT JOIN {prefix}posts p ON {table_name}.post_id = p.ID',
                'select_field' => 'p.post_title as post_title',
                'display_field' => 'post_title'
            ],
            'field_inputs' => [
                'label' => 'Field Inputs',
                'type' => 'text',
                'sortable' => false,
                'searchable' => true,
                'truncate' => 100
            ],
            'personalized_content' => [
                'label' => 'Personalized Content',
                'type' => 'text',
                'sortable' => false,
                'searchable' => true,
                'truncate' => 150
            ],
            'fields_hash' => [
                'label' => 'Fields Hash',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true,
                'truncate' => 20
            ],
            'created_at' => [
                'label' => 'Created',
                'type' => 'date',
                'sortable' => true,
                'format' => 'datetime'
            ]
        ],
        'pagination' => ['per_page' => 20, 'enabled' => true],
        'search_field' => 'personalized_content',
        'search_placeholder' => 'Search personalized content...',
        'actions' => ['delete_selected', 'export_selected', 'bulk_delete'],
        'bulk_actions' => ['delete'],
        'row_actions' => ['edit', 'delete', 'preview']
    ],
    
    // Personalize Tones Table
    'personalize_tones' => [
        'table' => 'igny8_tones',
        'title' => 'Tone Management',
        'columns' => [
            'tone_name' => [
                'label' => 'Tone Name',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true
            ],
            'description' => [
                'label' => 'Description',
                'type' => 'text',
                'sortable' => false,
                'searchable' => true,
                'truncate' => 150
            ],
            'category' => [
                'label' => 'Category',
                'type' => 'enum',
                'options' => ['business', 'creative', 'technical', 'marketing', 'educational'],
                'sortable' => true
            ],
            'status' => [
                'label' => 'Status',
                'type' => 'enum',
                'options' => ['active', 'inactive', 'draft'],
                'sortable' => true
            ],
            'usage_count' => [
                'label' => 'Usage Count',
                'type' => 'number',
                'sortable' => true
            ],
            'created_date' => [
                'label' => 'Created',
                'type' => 'date',
                'sortable' => true,
                'format' => 'date'
            ]
        ],
        'pagination' => ['per_page' => 10, 'enabled' => true],
        'search_field' => 'tone_name',
        'search_placeholder' => 'Search tones...',
        'actions' => ['delete_selected', 'export_selected', 'import', 'add_new'],
        'bulk_actions' => ['delete', 'activate', 'deactivate'],
        'row_actions' => ['edit', 'delete', 'duplicate', 'preview']
    ],

    // Personalization Data Table
    'personalize_data' => [
        'table' => 'igny8_data',
        'title' => 'Personalization Data',
        'humanize_columns' => ['post_id', 'data_type', 'data', 'created_at'],
        'columns' => [
            'post_id' => [
                'label' => 'Post ID',
                'type' => 'number',
                'sortable' => true,
                'display_field' => 'post_title',
                'join' => [
                    'table' => 'posts',
                    'on' => 'igny8_data.post_id = posts.ID',
                    'type' => 'LEFT'
                ]
            ],
            'data_type' => [
                'label' => 'Data Type',
                'type' => 'text',
                'sortable' => true,
                'searchable' => true
            ],
            'data' => [
                'label' => 'Data',
                'type' => 'json',
                'sortable' => false,
                'format' => 'json_preview'
            ],
            'created_at' => [
                'label' => 'Created',
                'type' => 'date',
                'sortable' => true,
                'format' => 'datetime'
            ]
        ],
        'pagination' => ['per_page' => 20, 'enabled' => true],
        'search_field' => 'data_type',
        'search_placeholder' => 'Search data types...',
        'actions' => ['delete_selected', 'export_selected'],
        'bulk_actions' => ['delete'],
        'row_actions' => ['view', 'delete']
    ],

    // Personalization Variations Table
    'personalize_variations' => [
        'table' => 'igny8_variations',
        'title' => 'Content Variations',
        'humanize_columns' => ['post_id', 'fields_hash', 'content', 'created_at'],
        'columns' => [
            'post_id' => [
                'label' => 'Post ID',
                'type' => 'number',
                'sortable' => true,
                'display_field' => 'post_title',
                'join' => [
                    'table' => 'posts',
                    'on' => 'igny8_variations.post_id = posts.ID',
                    'type' => 'LEFT'
                ]
            ],
            'fields_hash' => [
                'label' => 'Fields Hash',
                'type' => 'text',
                'sortable' => true,
                'format' => 'hash_preview'
            ],
            'content' => [
                'label' => 'Content',
                'type' => 'text',
                'sortable' => false,
                'format' => 'content_preview'
            ],
            'created_at' => [
                'label' => 'Created',
                'type' => 'date',
                'sortable' => true,
                'format' => 'datetime'
            ]
        ],
        'pagination' => ['per_page' => 20, 'enabled' => true],
        'search_field' => 'fields_hash',
        'search_placeholder' => 'Search variations...',
        'actions' => ['delete_selected', 'export_selected'],
        'bulk_actions' => ['delete'],
        'row_actions' => ['view', 'edit', 'delete']
    ]
];

