CREATE DATABASE IF NOT EXISTS andromeda_citizen;
USE andromeda_citizen;

-- Pengaturan Sistem
CREATE TABLE system_settings (
    id INT PRIMARY KEY AUTO_INCREMENT,
    youtube_url VARCHAR(255) DEFAULT 'https://www.youtube.com/@andromedacity-z9n',
    telegram_url VARCHAR(255) DEFAULT '',
    tiktok_url VARCHAR(255) DEFAULT '',
    instagram_url VARCHAR(255) DEFAULT '',
    task_duration INT DEFAULT 35,
    site_title VARCHAR(100) DEFAULT 'Andromeda Citizen System',
    theme_primary VARCHAR(20) DEFAULT '#00CCFF',
    theme_success VARCHAR(20) DEFAULT '#00FF99',
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

-- Statistik Pengunjung
CREATE TABLE visitor_logs (
    id INT PRIMARY KEY AUTO_INCREMENT,
    ip_address VARCHAR(45) NOT NULL,
    captcha_verified TINYINT DEFAULT 0,
    tasks_completed TINYINT DEFAULT 0,
    code_generated VARCHAR(20) NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Data Awal
INSERT INTO system_settings () VALUES ();
-- Sandi: andromeda2026
