import prisma from '../lib/prisma.js';

export async function findUserByEmail(email: string) {
  return prisma.users.findUnique({ where: { email } });
}

export async function findUserById(id: string) {
  return prisma.users.findUnique({ where: { id } });
}

export async function createUser(data: {
  id: string;
  name: string;
  email: string;
  password: string;
  updatedAt: Date;
}) {
  return prisma.users.create({ data });
}

export async function updateUser(
  id: string,
  data: Partial<{
    name: string;
    email: string;
    password: string;
    profilePhoto: string;
    bio: string;
    updatedAt: Date;
  }>
) {
  return prisma.users.update({ where: { id }, data });
}

export async function deleteUser(id: string) {
  return prisma.users.delete({ where: { id } });
}