<?php
function createTable(PDO $db): void
{
    $db->exec(
        "CREATE TABLE IF NOT EXISTS accounts(
        id INT NOT NULL AUTO_INCREMENT,
        PRIMARY KEY(id),
            sessionName VARCHAR(100),
            stats VARCHAR(90),
            bio VARCHAR(10),
            name VARCHAR(10),
            reply VARCHAR(10),
            flood VARCHAR(10),
            floodTime INT(50),
            hash VARCHAR(100),
            phone VARCHAR(200),
            timeon INT(30),
            timer INT(30),
            spm VARCHAR(30),
            timerz VARCHAR(30)
            );
        CREATE TABLE IF NOT EXISTS manager(
            gp BIGINT(50),
            gps JSON COLLATE utf8mb4_persian_ci,
            enemylist JSON,
            foshlist JSON COLLATE utf8mb4_persian_ci,
            pText VARCHAR(5000) COLLATE utf8mb4_persian_ci,
            mens JSON,
            step VARCHAR(1000),
            delall VARCHAR(20),
            spamtime INT(30),
            spampv INT(30)
            )"
    );
    if ($db->query("SELECT gp FROM `manager`")->rowCount() <= 0) {
        $st = $db->prepare("INSERT INTO `manager`(gp,gps,enemylist,foshlist,pText,mens,step,delall,spamtime,spampv) VALUES(:g,:gs,:en,:fs,:pt,:me,:st,:dl,:sm,:spa)");
        $st->execute([
            ':g' => 0,
            ':gs' => json_encode([]),
            ':en' => json_encode([]),
            ':fs' => json_encode([]),
            ':pt' => "",
            ':me' => json_encode([]),
            ':st' => "none",
            ':dl' => "off",
            ':sm' => 2,
            ':spa' => 0
        ]);
    }
}