CREATE TABLE IF NOT EXISTS `email_mailboxes` (
    `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
    `name` VARCHAR(100) NOT NULL,
    `smtp_host` VARCHAR(255) NOT NULL,
    `smtp_port` SMALLINT UNSIGNED NOT NULL DEFAULT 587,
    `smtp_encryption` ENUM('tls','ssl','none') NOT NULL DEFAULT 'tls',
    `smtp_username` VARCHAR(255) NOT NULL,
    `smtp_password_encrypted` TEXT NOT NULL,
    `sender_email` VARCHAR(255) NOT NULL,
    `sender_name` VARCHAR(200) DEFAULT NULL,
    `is_default` TINYINT(1) NOT NULL DEFAULT 0,
    `is_active` TINYINT(1) NOT NULL DEFAULT 1,
    `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
