/**
 * Contacts Domain Adapter
 *
 * Routes contact_messages and contact_submissions CRUD to Prisma.
 * Prisma passthrough for now; Convex path will be added when
 * mutations are available.
 */

import { prisma } from "@/lib/db";

export const contactMessagesAdapter = {
  async findMany(args: {
    where?: Record<string, unknown>;
    orderBy?: Record<string, unknown>;
  }) {
    return prisma.contact_messages.findMany(args as never);
  },

  async create(args: { data: Record<string, unknown> }) {
    return prisma.contact_messages.create(args as never);
  },
};

export const contactSubmissionsAdapter = {
  async findUnique(args: {
    where: Record<string, unknown>;
    select?: Record<string, boolean>;
  }) {
    return prisma.contact_submissions.findUnique(args as never);
  },

  async findFirst(args: {
    where?: Record<string, unknown>;
    select?: Record<string, boolean>;
  }) {
    return prisma.contact_submissions.findFirst(args as never);
  },

  async findMany(args: {
    where?: Record<string, unknown>;
    select?: Record<string, boolean>;
    orderBy?: Record<string, unknown> | Record<string, unknown>[];
    take?: number;
    skip?: number;
  }) {
    return prisma.contact_submissions.findMany(args as never);
  },

  async create(args: { data: Record<string, unknown> }) {
    return prisma.contact_submissions.create(args as never);
  },

  async update(args: {
    where: Record<string, unknown>;
    data: Record<string, unknown>;
  }) {
    return prisma.contact_submissions.update(args as never);
  },

  async count(args?: { where?: Record<string, unknown> }) {
    return prisma.contact_submissions.count(args as never);
  },

  async delete(args: { where: Record<string, unknown> }) {
    return prisma.contact_submissions.delete(args as never);
  },

  async deleteMany(args?: { where?: Record<string, unknown> }) {
    return prisma.contact_submissions.deleteMany(args as never);
  },
};
