import { pgTable, uuid, text, boolean, timestamp } from "drizzle-orm/pg-core"

export const authUsers = pgTable("auth_users", {
    id: uuid("id").primaryKey().defaultRandom(),

    created_at: timestamp("created_at", { withTimezone: true })
        .notNull()
        .defaultNow(),

    email: text("email").notNull(),
    passwordHash: text("password_hash").notNull(),

    multiTenant: boolean("multi_tenant").notNull().default(true),
    must_change_password: boolean("must_change_password").notNull().default(false),
    is_admin: boolean("is_admin").notNull().default(false),

    updatedAt: timestamp("updated_at", { withTimezone: true }),

    ported: boolean("ported").notNull().default(true),
})

export type AuthUser = typeof authUsers.$inferSelect
export type NewAuthUser = typeof authUsers.$inferInsert
