CREATE TABLE IF NOT EXISTS `users` (
    `id`                INT UNSIGNED NOT NULL AUTO_INCREMENT,
    `name`              VARCHAR(120) NOT NULL,
    `email`             VARCHAR(180) NOT NULL,
    `password`          VARCHAR(255) NOT NULL,
    `role`              ENUM('client','therapist','company','superadmin') NOT NULL DEFAULT 'client',
    `avatar`            VARCHAR(255) NULL,
    `phone`             VARCHAR(30) NULL,
    `email_verified_at` DATETIME NULL,
    `remember_token`    VARCHAR(100) NULL,
    `lang`              ENUM('lv','ru','en') NOT NULL DEFAULT 'lv',
    `is_active`         TINYINT(1) NOT NULL DEFAULT 1,
    `last_login_at`     DATETIME NULL,
    `created_at`        DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `updated_at`        DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    UNIQUE KEY `users_email_unique` (`email`),
    KEY `users_role_index` (`role`),
    KEY `users_is_active_index` (`is_active`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
