CREATE DATABASE IF NOT EXISTS painel;
USE painel;

CREATE TABLE IF NOT EXISTS usuarios (
    id INT AUTO_INCREMENT PRIMARY KEY,
    usuario VARCHAR(50) NOT NULL UNIQUE,
    senha VARCHAR(255) NOT NULL
);

CREATE TABLE IF NOT EXISTS config (
    id INT AUTO_INCREMENT PRIMARY KEY,
    url VARCHAR(255) NOT NULL,
    delay_min INT NOT NULL,
    delay_max INT NOT NULL,
    preserve_query BOOLEAN DEFAULT TRUE
);

INSERT INTO usuarios (usuario, senha) VALUES (
    'admin',
    '$2b$12$bqaEUc4W6obZr4F7nrRYoOP9GXnO0bAZesVvNM2cWXnAzeb9sbMjC'
);

INSERT INTO config (url, delay_min, delay_max, preserve_query)
VALUES ('https://emissao-passaporte.org/', 120, 450, true);