<?php
/**
 * ==========================
 * 🔐 IGNY8 FILE RULE HEADER
 * ==========================
 * @file         : filters-config.php
 * @location     : /modules/config/filters-config.php
 * @type         : Config Array
 * @scope        : Global
 * @allowed      : Filter definitions, search configurations
 * @reusability  : Globally Reusable
 * @notes        : Central filter configuration for all modules
 */

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

return [
    // Keywords Filters
    'planner_keywords' => [
        'keyword' => [
            'type' => 'search',
            'placeholder' => 'Search keywords...',
            'field' => 'keyword'
        ],
        'intent' => [
            'type' => 'select',
            'label' => 'Intent',
            'field' => 'intent',
            'options' => [
                'informational' => 'Informational',
                'navigational' => 'Navigational',
                'transactional' => 'Transactional',
                'commercial' => 'Commercial'
            ]
        ],
        'status' => [
            'type' => 'select',
            'label' => 'Status',
            'field' => 'status',
            'options' => [
                'unmapped' => 'Unmapped',
                'mapped' => 'Mapped',
                'queued' => 'Queued',
                'published' => 'Published'
            ]
        ],
    'difficulty' => [
        'type' => 'select',
        'label' => 'Difficulty',
        'field' => 'difficulty',
        'options' => [
            'Very Easy' => 'Very Easy',
            'Easy' => 'Easy',
            'Medium' => 'Medium',
            'Hard' => 'Hard',
            'Very Hard' => 'Very Hard'
        ]
    ],
        'search_volume' => [
            'type' => 'range',
            'label' => 'Volume',
            'field' => 'search_volume',
            'min' => 0,
            'max' => 100000
        ]
    ],
    
    // Clusters Filters
    'planner_clusters' => [
        'cluster_name' => [
            'type' => 'search',
            'placeholder' => 'Search clusters...',
            'field' => 'cluster_name'
        ],
        'sector_id' => [
            'type' => 'select',
            'label' => 'Sector',
            'field' => 'sector_id',
            'options' => 'dynamic_sectors' // Will be loaded via AJAX
        ],
        'status' => [
            'type' => 'select',
            'label' => 'Status',
            'field' => 'status',
            'options' => [
                'active' => 'Active',
                'inactive' => 'Inactive',
                'archived' => 'Archived'
            ]
        ],
        'keyword_count' => [
            'type' => 'range',
            'label' => 'Keywords Count',
            'field' => 'keyword_count',
            'min' => 0,
            'max' => 1000
        ]
    ],
    
    // Ideas Filters
    'planner_ideas' => [
        'idea_title' => [
            'type' => 'search',
            'placeholder' => 'Search ideas...',
            'field' => 'idea_title'
        ],
        'content_structure' => [
            'type' => 'select',
            'label' => 'Content Structure',
            'field' => 'content_structure',
            'options' => [
                'cluster_hub' => 'Cluster Hub',
                'landing_page' => 'Landing Page',
                'guide_tutorial' => 'Guide Tutorial',
                'how_to' => 'How To',
                'comparison' => 'Comparison',
                'review' => 'Review',
                'top_listicle' => 'Top Listicle',
                'question' => 'Question',
                'product_description' => 'Product Description',
                'service_page' => 'Service Page',
                'home_page' => 'Home Page'
            ]
        ],
        'source' => [
            'type' => 'select',
            'label' => 'Source',
            'field' => 'source',
            'options' => [
                'AI' => 'AI',
                'Manual' => 'Manual'
            ]
        ],
        'status' => [
            'type' => 'select',
            'label' => 'Status',
            'field' => 'status',
            'options' => [
                'new' => 'New',
                'scheduled' => 'Scheduled',
                'published' => 'Published'
            ]
        ],
        'keyword_cluster_id' => [
            'type' => 'select',
            'label' => 'Cluster',
            'field' => 'keyword_cluster_id',
            'options' => 'dynamic_clusters'
        ],
        'estimated_word_count' => [
            'type' => 'range',
            'label' => 'Word Count',
            'field' => 'estimated_word_count',
            'min' => 0,
            'max' => 5000
        ]
    ],
    
    
    // Writer Tasks Filters (Content Queue / Tasks)
    'writer_tasks' => [
        'title' => [
            'type' => 'search',
            'placeholder' => 'Search tasks...',
            'field' => 'title'
        ],
        'keywords' => [
            'type' => 'search',
            'placeholder' => 'Search keywords...',
            'field' => 'keywords'
        ],
        'cluster_id' => [
            'type' => 'select',
            'label' => 'Cluster Name',
            'field' => 'cluster_id',
            'options' => 'dynamic_clusters'
        ],
        'status' => [
            'type' => 'select',
            'label' => 'Status',
            'field' => 'status',
            'options' => [
                'queued' => 'Queued',
                'in_progress' => 'In Progress',
                'completed' => 'Completed',
                'cancelled' => 'Cancelled',
                'draft' => 'Draft',
                'review' => 'Review',
                'published' => 'Published'
            ]
        ],
        'content_type' => [
            'type' => 'select',
            'label' => 'Content Type',
            'field' => 'content_type',
            'options' => [
                'blog_post' => 'Blog Post',
                'landing_page' => 'Landing Page',
                'product_page' => 'Product Page',
                'guide_tutorial' => 'Guide Tutorial',
                'news_article' => 'News Article',
                'review' => 'Review',
                'comparison' => 'Comparison',
                'email' => 'Email',
                'social_media' => 'Social Media'
            ]
        ],
        'created_at' => [
            'type' => 'date_range',
            'label' => 'Queued Date Range',
            'field' => 'created_at'
        ]
    ],

    // Writer Drafts Filters (Content Generated)
    'writer_drafts' => [
        'title' => [
            'type' => 'search',
            'placeholder' => 'Search drafts...',
            'field' => 'title'
        ],
        'status' => [
            'type' => 'select',
            'label' => 'Status',
            'field' => 'status',
            'options' => [
                'draft' => 'Draft',
                'review' => 'Review'
            ]
        ],
        'content_type' => [
            'type' => 'select',
            'label' => 'Content Type',
            'field' => 'content_type',
            'options' => [
                'blog_post' => 'Blog Post',
                'landing_page' => 'Landing Page',
                'product_page' => 'Product Page',
                'guide_tutorial' => 'Guide Tutorial',
                'news_article' => 'News Article',
                'review' => 'Review',
                'comparison' => 'Comparison',
                'email' => 'Email',
                'social_media' => 'Social Media'
            ]
        ],
        'cluster_id' => [
            'type' => 'select',
            'label' => 'Cluster',
            'field' => 'cluster_id',
            'options' => 'dynamic_clusters'
        ],
        'meta_status' => [
            'label' => 'Meta Status',
            'type' => 'select',
            'options' => [
                'all' => 'All',
                'complete' => 'Meta Present',
                'missing' => 'Meta Missing'
            ]
        ],
        'keywords' => [
            'label' => 'Keywords',
            'type' => 'text',
            'searchable' => true
        ]
    ],
    
    // Writer Published Filters (Live Content)
    'writer_published' => [
        'title' => [
            'type' => 'search',
            'placeholder' => 'Search published content...',
            'field' => 'title'
        ],
        'status' => [
            'type' => 'select',
            'label' => 'Status',
            'field' => 'status',
            'options' => [
                'published' => 'Published'
            ]
        ],
        'content_type' => [
            'type' => 'select',
            'label' => 'Content Type',
            'field' => 'content_type',
            'options' => [
                'blog_post' => 'Blog Post',
                'landing_page' => 'Landing Page',
                'product_page' => 'Product Page',
                'guide_tutorial' => 'Guide Tutorial',
                'news_article' => 'News Article',
                'review' => 'Review',
                'comparison' => 'Comparison',
                'email' => 'Email',
                'social_media' => 'Social Media'
            ]
        ],
        'cluster_id' => [
            'type' => 'select',
            'label' => 'Cluster',
            'field' => 'cluster_id',
            'options' => 'dynamic_clusters'
        ],
        'meta_status' => [
            'label' => 'Meta Status',
            'type' => 'select',
            'options' => [
                'all' => 'All',
                'complete' => 'Meta Present',
                'missing' => 'Meta Missing'
            ]
        ],
        'keywords' => [
            'label' => 'Keywords',
            'type' => 'text',
            'searchable' => true
        ],
        'created_at' => [
            'type' => 'date_range',
            'label' => 'Date Range',
            'field' => 'created_at'
        ]
    ],
    
    // Optimizer Audits Filters
    'optimizer_audits' => [
        'page_url' => [
            'type' => 'search',
            'placeholder' => 'Search pages...',
            'field' => 'page_url'
        ],
        'audit_status' => [
            'type' => 'select',
            'label' => 'Audit Status',
            'field' => 'audit_status',
            'options' => [
                'pending' => 'Pending',
                'in_progress' => 'In Progress',
                'completed' => 'Completed',
                'failed' => 'Failed'
            ]
        ],
        'score_range' => [
            'type' => 'range',
            'label' => 'SEO Score',
            'field' => 'seo_score',
            'min' => 0,
            'max' => 100
        ],
        'last_audit' => [
            'type' => 'date_range',
            'label' => 'Last Audit',
            'field' => 'last_audit_date'
        ]
    ],
    
    // Linker Backlinks Filters
    'linker_backlinks' => [
        'target_url' => [
            'type' => 'search',
            'placeholder' => 'Search target URLs...',
            'field' => 'target_url'
        ],
        'source_domain' => [
            'type' => 'search',
            'placeholder' => 'Search source domains...',
            'field' => 'source_domain'
        ],
        'link_type' => [
            'type' => 'select',
            'label' => 'Link Type',
            'field' => 'link_type',
            'options' => [
                'dofollow' => 'DoFollow',
                'nofollow' => 'NoFollow',
                'sponsored' => 'Sponsored',
                'ugc' => 'UGC'
            ]
        ],
        'status' => [
            'type' => 'select',
            'label' => 'Status',
            'field' => 'status',
            'options' => [
                'active' => 'Active',
                'lost' => 'Lost',
                'pending' => 'Pending'
            ]
        ],
        'domain_authority' => [
            'type' => 'range',
            'label' => 'Domain Authority',
            'field' => 'domain_authority',
            'min' => 0,
            'max' => 100
        ]
    ],
    
    // Writer Templates Filters
    'writer_templates' => [
        'prompt_name' => [
            'type' => 'search',
            'placeholder' => 'Search templates...',
            'field' => 'prompt_name'
        ],
        'prompt_type' => [
            'type' => 'select',
            'label' => 'Category',
            'field' => 'prompt_type',
            'options' => [
                'content' => 'Blog',
                'optimization' => 'Review',
                'generation' => 'Product',
                'custom' => 'Custom'
            ]
        ],
        'is_active' => [
            'type' => 'select',
            'label' => 'Status',
            'field' => 'is_active',
            'options' => [
                '1' => 'Active',
                '0' => 'Draft'
            ]
        ],
        'created_at' => [
            'type' => 'date_range',
            'label' => 'Created Date',
            'field' => 'created_at'
        ]
    ],
    
    // Optimizer Suggestions Filters
    'optimizer_suggestions' => [
        'page_url' => [
            'type' => 'search',
            'placeholder' => 'Search pages...',
            'field' => 'page_url'
        ],
        'suggestion_type' => [
            'type' => 'select',
            'label' => 'Suggestion Type',
            'field' => 'suggestion_type',
            'options' => [
                'title_optimization' => 'Title Optimization',
                'meta_description' => 'Meta Description',
                'heading_structure' => 'Heading Structure',
                'content_improvement' => 'Content Improvement',
                'internal_linking' => 'Internal Linking'
            ]
        ],
        'priority' => [
            'type' => 'select',
            'label' => 'Priority',
            'field' => 'priority',
            'options' => [
                'high' => 'High',
                'medium' => 'Medium',
                'low' => 'Low'
            ]
        ],
        'status' => [
            'type' => 'select',
            'label' => 'Status',
            'field' => 'status',
            'options' => [
                'pending' => 'Pending',
                'in_progress' => 'In Progress',
                'completed' => 'Completed',
                'dismissed' => 'Dismissed'
            ]
        ],
        'impact_score' => [
            'type' => 'range',
            'label' => 'Impact Score',
            'field' => 'impact_score',
            'min' => 0,
            'max' => 100
        ]
    ],
    
    // Linker Campaigns Filters
    'linker_campaigns' => [
        'campaign_name' => [
            'type' => 'search',
            'placeholder' => 'Search campaigns...',
            'field' => 'campaign_name'
        ],
        'target_url' => [
            'type' => 'search',
            'placeholder' => 'Search target URLs...',
            'field' => 'target_url'
        ],
        'status' => [
            'type' => 'select',
            'label' => 'Status',
            'field' => 'status',
            'options' => [
                'planning' => 'Planning',
                'active' => 'Active',
                'paused' => 'Paused',
                'completed' => 'Completed',
                'cancelled' => 'Cancelled'
            ]
        ],
        'completion_percentage' => [
            'type' => 'range',
            'label' => 'Completion %',
            'field' => 'completion_percentage',
            'min' => 0,
            'max' => 100
        ],
        'start_date' => [
            'type' => 'date_range',
            'label' => 'Start Date',
            'field' => 'start_date'
        ]
    ],
    
    // Personalize Rewrites Filters
    'personalize_rewrites' => [
        'personalized_content' => [
            'type' => 'search',
            'placeholder' => 'Search personalized content...',
            'field' => 'personalized_content'
        ],
        'field_inputs' => [
            'type' => 'search',
            'placeholder' => 'Search field inputs...',
            'field' => 'field_inputs'
        ],
        'post_id' => [
            'type' => 'search',
            'placeholder' => 'Search by post ID...',
            'field' => 'post_id'
        ],
        'created_at' => [
            'type' => 'date_range',
            'label' => 'Created Date',
            'field' => 'created_at'
        ]
    ],
    
    // Personalize Tones Filters
    'personalize_tones' => [
        'tone_name' => [
            'type' => 'search',
            'placeholder' => 'Search tones...',
            'field' => 'tone_name'
        ],
        'category' => [
            'type' => 'select',
            'label' => 'Category',
            'field' => 'category',
            'options' => [
                'business' => 'Business',
                'creative' => 'Creative',
                'technical' => 'Technical',
                'marketing' => 'Marketing',
                'educational' => 'Educational'
            ]
        ],
        'status' => [
            'type' => 'select',
            'label' => 'Status',
            'field' => 'status',
            'options' => [
                'active' => 'Active',
                'inactive' => 'Inactive',
                'draft' => 'Draft'
            ]
        ],
        'usage_count' => [
            'type' => 'range',
            'label' => 'Usage Count',
            'field' => 'usage_count',
            'min' => 0,
            'max' => 1000
        ]
    ]
];
