/**
 * Identity domain. Pure types and rules: no framework, no infrastructure.
 */

import type { Role } from '../../../shared/auth.js';

export interface User {
  id: string;
  email: string;
  role: Role;
  createdAt: Date;
}

export interface NewUser {
  email: string;
  passwordHash: string;
}

/** Canonical form: trimmed + lowercased. citext backs uniqueness in the DB. */
export function normalizeEmail(raw: string): string {
  return raw.trim().toLowerCase();
}
