<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Content Moderation Configuration
    |--------------------------------------------------------------------------
    */

    'scanner_version' => '3.0',

    'queue_threshold' => 30,

    'rules' => [
        'enabled' => [
            \App\Services\Moderation\Rules\LinkPresenceRule::class,
            \App\Services\Moderation\Rules\DomainBlacklistRule::class,
            \App\Services\Moderation\Rules\SuspiciousKeywordRule::class,
            \App\Services\Moderation\Rules\RegexPatternRule::class,
            \App\Services\Moderation\Rules\UnicodeObfuscationRule::class,
            \App\Services\Moderation\Rules\RepeatedPhraseRule::class,
            \App\Services\Moderation\Rules\DuplicateCommentRule::class,
            \App\Services\Moderation\Rules\NearDuplicateCampaignRule::class,
            \App\Services\Moderation\Rules\KeywordStuffingRule::class,
            \App\Services\Moderation\Rules\ExcessivePunctuationRule::class,
        ],
    ],

    'auto_hide' => [
        'enabled' => true,
        'threshold' => 95,
        'supported_types' => [
            'artwork_comment',
            'artwork_description',
            'artwork_title',
        ],
    ],

    'future_content_types' => [
        'user_bio',
        'user_profile_link',
        'collection_title',
        'collection_description',
        'story_title',
        'story_content',
        'card_title',
        'card_text',
    ],

    'suggestions' => [
        'provider' => env('CONTENT_MODERATION_SUGGESTION_PROVIDER', 'heuristic'),
    ],

    'policies' => [
        'default' => [
            'queue_threshold' => 30,
            'auto_hide_threshold' => 95,
            'priority_bonus' => 0,
            'review_bucket' => 'standard',
        ],
        'strict_seo_protection' => [
            'queue_threshold' => 22,
            'auto_hide_threshold' => 90,
            'priority_bonus' => 20,
            'review_bucket' => 'urgent',
        ],
        'new_user_strict_mode' => [
            'queue_threshold' => 24,
            'auto_hide_threshold' => 92,
            'priority_bonus' => 14,
            'review_bucket' => 'high',
        ],
        'trusted_user_relaxed_mode' => [
            'queue_threshold' => 38,
            'auto_hide_threshold' => 100,
            'priority_bonus' => -8,
            'review_bucket' => 'standard',
        ],
        'comments_high_volume_antispam' => [
            'queue_threshold' => 20,
            'auto_hide_threshold' => 88,
            'priority_bonus' => 18,
            'review_bucket' => 'high',
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Severity Thresholds
    |--------------------------------------------------------------------------
    | Score boundaries for severity levels.
    */
    'severity_thresholds' => [
        'critical' => 90,
        'high'     => 60,
        'medium'   => 30,
    ],

    /*
    |--------------------------------------------------------------------------
    | Rule Weights
    |--------------------------------------------------------------------------
    | Score contribution per rule match.
    */
    'weights' => [
        'blacklisted_domain'       => 70,
        'suspicious_domain'        => 40,
        'single_external_link'     => 20,
        'multiple_links'           => 40,
        'shortened_link'           => 30,
        'suspicious_keyword'       => 25,
        'high_risk_keyword'        => 40,
        'unicode_obfuscation'      => 30,
        'repeated_phrase'          => 25,
        'duplicate_comment'        => 35,
        'near_duplicate_campaign'  => 30,
        'keyword_stuffing'         => 20,
        'excessive_punctuation'    => 15,
        'regex_pattern'            => 30,
    ],

    'duplicate_detection' => [
        'near_duplicate_similarity' => 84,
    ],

    'user_risk' => [
        'high_modifier' => 18,
        'medium_modifier' => 10,
        'low_modifier' => 4,
        'trusted_modifier' => -6,
    ],

    /*
    |--------------------------------------------------------------------------
    | Blacklisted Domains
    |--------------------------------------------------------------------------
    | Domains that immediately score high. Patterns support * wildcard.
    */
    'blacklisted_domains' => [
        '*.casino-*.com',
        '*.bet365*',
        '*.pokerstars*',
        '*.1xbet*',
        '*.parimatch*',
        '*.888casino*',
        '*.slotmachine*',
        '*.onlinecasino*',
        '*.buycheap*',
        '*.cheapviagra*',
        '*.pillsonline*',
        '*.pharma-*',
        '*.xn--*',
        '*.webcam-show*',
        '*.livecam*',
        '*.adult-*',
        '*.porn*',
        '*.xxx*',
        '*.cryptoairdrop*',
        '*.free-bitcoin*',
        '*.moonshot-token*',
    ],

    /*
    |--------------------------------------------------------------------------
    | Suspicious Domains
    |--------------------------------------------------------------------------
    | Domains that add moderate score.
    */
    'suspicious_domains' => [
        '*.tk',
        '*.ml',
        '*.ga',
        '*.cf',
        '*.gq',
        '*.xyz',
        '*.top',
        '*.buzz',
        '*.club',
        '*.work',
        '*.click',
        '*.link',
        '*.info',
        '*.site',
        '*.online',
        '*.icu',
        '*.fun',
        '*.monster',
    ],

    /*
    |--------------------------------------------------------------------------
    | URL Shortener Domains
    |--------------------------------------------------------------------------
    */
    'shortener_domains' => [
        'bit.ly',
        'tinyurl.com',
        't.co',
        'goo.gl',
        'ow.ly',
        'is.gd',
        'buff.ly',
        'adf.ly',
        'bl.ink',
        'shorte.st',
        'clck.ru',
        'cutt.ly',
        'rb.gy',
        'shorturl.at',
    ],

    /*
    |--------------------------------------------------------------------------
    | Allowed Domains
    |--------------------------------------------------------------------------
    | Domains that should not be flagged.
    */
    'allowed_domains' => [
        'skinbase.org',
        'skinbase.si',
        'deviantart.com',
        'artstation.com',
        'behance.net',
        'dribbble.com',
        'pixiv.net',
        'instagram.com',
        'twitter.com',
        'x.com',
        'youtube.com',
        'youtu.be',
        'vimeo.com',
        'github.com',
        'wikipedia.org',
        'imgur.com',
        'flickr.com',
        'unsplash.com',
        'pinterest.com',
    ],

    /*
    |--------------------------------------------------------------------------
    | Suspicious Keywords
    |--------------------------------------------------------------------------
    | Phrases that indicate spam. grouped by risk level.
    */
    'keywords' => [
        'high_risk' => [
            'buy followers',
            'buy likes',
            'buy subscribers',
            'free bitcoin',
            'crypto giveaway',
            'crypto airdrop',
            'double your bitcoin',
            'send btc',
            'send eth',
            'online casino',
            'best casino',
            'casino bonus',
            'free spins',
            'slot machine',
            'sports betting',
            'bet now',
            'viagra',
            'cialis',
            'pharmacy online',
            'buy cheap',
            'discount pills',
            'weight loss pills',
            'diet pills',
            'earn money fast',
            'make money online',
            'work from home opportunity',
            'investment opportunity',
            'guaranteed income',
            'adult content',
            'webcam show',
            'live cam',
            'hookup',
            'dating site',
            'meet singles',
            'sexy girls',
            'hot women',
            'malware',
            'hack account',
            'free robux',
            'free v-bucks',
        ],
        'suspicious' => [
            'visit my site',
            'check my profile',
            'click here',
            'click the link',
            'follow me',
            'subscribe to my',
            'check out my website',
            'link in bio',
            'link in description',
            'free download',
            'limited time offer',
            'act now',
            'don\'t miss out',
            'exclusive deal',
            'best price',
            'cheap price',
            'seo service',
            'seo expert',
            'web development service',
            'marketing service',
            'backlink service',
            'guest post',
            'sponsored post',
            'promote your',
            'boost your',
            'increase traffic',
            'grow your followers',
            'dm for collab',
            'dm for business',
            'whatsapp me',
            'telegram me',
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Keyword Stuffing Detection
    |--------------------------------------------------------------------------
    */
    'keyword_stuffing' => [
        'min_word_count'            => 20,
        'max_unique_ratio'          => 0.3, // if unique/total < this, likely stuffing
        'max_single_word_frequency' => 0.25, // single word > 25% of total
    ],

    /*
    |--------------------------------------------------------------------------
    | Repeated Phrase Detection
    |--------------------------------------------------------------------------
    */
    'repeated_phrase' => [
        'min_phrase_length' => 4, // min words in phrase
        'min_repetitions'   => 3, // min times phrase must appear
    ],

    /*
    |--------------------------------------------------------------------------
    | Excessive Punctuation Detection
    |--------------------------------------------------------------------------
    */
    'excessive_punctuation' => [
        'max_exclamation_ratio' => 0.1, // ! per char ratio
        'max_question_ratio'    => 0.1,
        'max_caps_ratio'        => 0.7, // if > 70% uppercase
        'min_length'            => 20,
    ],

];
