CREATE DATABASE IF NOT EXISTS signal_bot;
USE signal_bot;

CREATE TABLE IF NOT EXISTS bot_settings (
    id INT PRIMARY KEY AUTO_INCREMENT,
    bot_status ENUM('ON', 'OFF') DEFAULT 'ON',
    signal_count INT DEFAULT 0,
    total_win INT DEFAULT 0,
    total_loss INT DEFAULT 0,
    is_paused BOOLEAN DEFAULT FALSE,
    result_lock VARCHAR(50) DEFAULT 'READY',
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);

CREATE TABLE IF NOT EXISTS signals (
    id INT PRIMARY KEY AUTO_INCREMENT,
    signal_number VARCHAR(20),
    result ENUM('WIN', 'LOSS', 'PENDING'),
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

INSERT INTO bot_settings (bot_status, signal_count) VALUES ('ON', 0);