// /types/user.ts

// ---- Roles ----
export type UserRole = "USER" | "ADMIN";

// If you ever add more:
// export type UserRole = "USER" | "ADMIN" | "SUPERADMIN" | "SUSPENDED";

// ---- Core user shapes ----
export interface BaseUser {
  id: string;
  email: string;
  displayName?: string | null;
  role: UserRole;
  createdAt: string;          // ISO string from backend
  updatedAt?: string | null;  // optional if you expose it
  lastLoginAt?: string | null;
}

// What the admin UI works with
export type AdminUser = BaseUser;

// What your auth context might use on the client
export type AuthUser = {
  id: string;
  email: string;
  displayName?: string | null;
  role: UserRole;
} | null;

// ---- Payloads / DTOs ----
export interface UpdateUserRolePayload {
  role: UserRole;
}