/**
 * User DB Mapper
 *
 * Adapts @prisma/client User to domain UserAuth type.
 * This thin adapter exists because domain cannot import @prisma/client directly.
 *
 * NOTE: UserAuth contains ONLY auth state. Profile data comes from WHMCS.
 * For complete user profile, use UsersFacade.getProfile() which fetches from WHMCS.
 */

import type { User as PrismaUser } from "@prisma/client";
import type { UserAuth } from "@customer-portal/domain/customer";
import { mapPrismaUserToUserAuth } from "@customer-portal/domain/customer/providers";

type PrismaUserRaw = Parameters<typeof mapPrismaUserToUserAuth>[0];

/**
 * Maps Prisma User entity to Domain UserAuth type
 */
export function mapPrismaUserToDomain(user: PrismaUser): UserAuth {
  // PrismaUser and PrismaUserRaw are structurally identical - cast and delegate
  return mapPrismaUserToUserAuth(user as PrismaUserRaw);
}
