-- Migration: Add blocked_edu_domains table
-- Purpose: Block known fake/temporary edu email domains from getting student status

CREATE TABLE IF NOT EXISTS blocked_edu_domains (
    id INT AUTO_INCREMENT PRIMARY KEY,
    domain VARCHAR(255) NOT NULL UNIQUE,
    reason VARCHAR(255) DEFAULT 'Suspicious temporary email service',
    added_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    added_by VARCHAR(100) DEFAULT 'system'
);

-- Insert known fake edu domains
INSERT IGNORE INTO blocked_edu_domains (domain, reason) VALUES 
    ('usa.edu.pl', 'Temporary email service - fake .edu.pl'),
    ('stu.edu.pl', 'Temporary email service - fake .edu.pl'),
    ('student.edu.pl', 'Temporary email service - fake .edu.pl'),
    ('uni.edu.pl', 'Temporary email service - fake .edu.pl'),
    ('mail.edu.pl', 'Temporary email service - fake .edu.pl'),
    ('edu.pl', 'Generic temp mail - not a real university'),
    ('10minutemail.edu', 'Disposable email service'),
    ('tempmail.edu', 'Disposable email service'),
    ('fakeedu.com', 'Fake edu email provider'),
    ('guerrillamail.edu', 'Disposable email service'),
    ('cross.edu.pl', 'Fake .edu.pl - active abuse detected Apr 2026'),
    ('nullsto.edu.pl', 'Fake .edu.pl - active abuse detected Apr 2026'),
    ('punkproof.com', 'Public disposable email service - active abuse detected Apr 2026');

-- Also add to existing student_domains table as blacklist check
-- We use negative logic: if domain is in blocked_edu_domains, reject it
