'use strict';

var pgCore = require('drizzle-orm/pg-core');
var drizzleOrm = require('drizzle-orm');

// src/auth/legacy/schema/index.ts
var legacyUsers = pgCore.pgTable("users", {
  id: pgCore.serial("id").primaryKey(),
  phone: pgCore.varchar("phone", { length: 20 }).notNull().unique(),
  password: pgCore.varchar("password", { length: 255 }).notNull(),
  name: pgCore.varchar("name", { length: 100 }),
  email: pgCore.varchar("email", { length: 255 }),
  isActive: pgCore.boolean("is_active").notNull().default(true),
  role: pgCore.varchar("role", { length: 20 }).notNull().default("user"),
  lastLoginAt: pgCore.timestamp("last_login_at"),
  createdAt: pgCore.timestamp("created_at").defaultNow().notNull(),
  updatedAt: pgCore.timestamp("updated_at").defaultNow().notNull()
});
var legacyUserSessions = pgCore.pgTable("user_sessions", {
  id: pgCore.serial("id").primaryKey(),
  userId: pgCore.integer("user_id").notNull().references(() => legacyUsers.id, { onDelete: "cascade" }),
  sessionToken: pgCore.varchar("session_token", { length: 255 }).notNull().unique(),
  expiresAt: pgCore.timestamp("expires_at").notNull(),
  createdAt: pgCore.timestamp("created_at").defaultNow().notNull()
});
var legacyVerificationCodes = pgCore.pgTable("verification_codes", {
  id: pgCore.serial("id").primaryKey(),
  phone: pgCore.text("phone").notNull(),
  code: pgCore.text("code").notNull(),
  expiresAt: pgCore.timestamp("expires_at").notNull(),
  createdAt: pgCore.timestamp("created_at").defaultNow().notNull(),
  used: pgCore.boolean("used").default(false).notNull()
});
var legacyUsersRelations = drizzleOrm.relations(legacyUsers, ({ many }) => ({
  sessions: many(legacyUserSessions)
}));
var legacyUserSessionsRelations = drizzleOrm.relations(legacyUserSessions, ({ one }) => ({
  user: one(legacyUsers, {
    fields: [legacyUserSessions.userId],
    references: [legacyUsers.id]
  })
}));

exports.legacyUserSessions = legacyUserSessions;
exports.legacyUserSessionsRelations = legacyUserSessionsRelations;
exports.legacyUsers = legacyUsers;
exports.legacyUsersRelations = legacyUsersRelations;
exports.legacyVerificationCodes = legacyVerificationCodes;
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map