<?php

return [
    'enabled' => env('SKINBASE_AI_MODERATION_ENABLED', true),

    'provider' => env('SKINBASE_AI_MODERATION_PROVIDER', 'openai'),

    'queue' => [
        'name' => env('SKINBASE_AI_MODERATION_QUEUE', 'forum-moderation'),
    ],

    'preflight' => [
        'run_ai_sync' => (bool) env('SKINBASE_AI_PREFLIGHT_SYNC', true),
    ],

    'thresholds' => [
        'safe' => 20,
        'low_quality' => 40,
        'suspicious' => 60,
        'block' => 80,
    ],

    'behavior' => [
        'new_account_days' => 7,
        'rapid_post_window_minutes' => 2,
        'rapid_post_threshold' => 5,
        'same_ip_window_days' => 7,
        'same_ip_accounts_threshold' => 2,
        'repeat_content_penalty' => 40,
        'new_account_with_links_penalty' => 30,
        'rapid_post_penalty' => 20,
        'same_ip_penalty' => 25,
        'high_link_frequency_penalty' => 10,
        'flagged_history_penalty' => 15,
    ],

    'links' => [
        'too_many_links_penalty' => 15,
        'suspicious_domain_penalty' => 40,
        'shortener_penalty' => 10,
        'suspicious_tld_penalty' => 15,
        'too_many_links_threshold' => 3,
        'shorteners' => [
            'bit.ly',
            'tinyurl.com',
            'goo.gl',
            't.co',
            'ow.ly',
            'cutt.ly',
            'rebrand.ly',
        ],
        'suspicious_tlds' => [
            'xyz',
            'top',
            'click',
            'loan',
            'work',
            'gq',
            'ml',
            'tk',
        ],
    ],

    'trust' => [
        'high' => 80,
        'medium' => 50,
        'high_modifier' => -15,
        'medium_modifier' => -8,
        'low_modifier' => 0,
        'flagged_ratio_penalty' => 10,
    ],

    'learning' => [
        'spam_penalty' => 40,
        'safe_modifier' => -12,
        'max_spam_penalty' => 60,
        'max_safe_modifier' => -20,
    ],

    'scan' => [
        'limit' => 200,
        'stale_after_minutes' => 10,
    ],

    'privacy' => [
        'redact_emails' => true,
        'redact_ip_addresses' => true,
        'redact_mentions' => false,
    ],

    'heuristics' => [
        'promotional_phrases' => [
            'buy now',
            'limited offer',
            'cheap seo',
            'guaranteed traffic',
            'visit my profile',
            'work from home',
            'crypto signal',
            'telegram me',
            'whatsapp me',
            'dm for service',
        ],
        'toxic_phrases' => [
            'kill yourself',
            'you idiot',
            'piece of trash',
            'hate you',
            'worthless',
        ],
    ],

    'providers' => [
        'openai' => [
            'api_key' => env('OPENAI_API_KEY'),
            'base_url' => env('OPENAI_BASE_URL', 'https://api.openai.com/v1'),
            'model' => env('SKINBASE_AI_OPENAI_MODEL', 'gpt-4.1-mini'),
            'timeout' => (int) env('SKINBASE_AI_OPENAI_TIMEOUT', 5),
        ],
        'perspective_api' => [
            'api_key' => env('PERSPECTIVE_API_KEY'),
            'base_url' => env('PERSPECTIVE_API_BASE_URL', 'https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze'),
            'timeout' => (int) env('SKINBASE_AI_PERSPECTIVE_TIMEOUT', 5),
        ],
        'local_llm' => [
            'endpoint' => env('SKINBASE_AI_LOCAL_LLM_ENDPOINT'),
            'model' => env('SKINBASE_AI_LOCAL_LLM_MODEL', 'moderation'),
            'timeout' => (int) env('SKINBASE_AI_LOCAL_LLM_TIMEOUT', 5),
            'token' => env('SKINBASE_AI_LOCAL_LLM_TOKEN'),
        ],
    ],
];
