/**
 * Integrations Domain Adapter
 *
 * Routes integrations model to Prisma or Convex based on data-source config.
 *
 * NOTE: Convex has no mutations/queries yet for this domain —
 * all paths currently delegate to Prisma. The Convex path is
 * scaffolded for when mutations are added.
 */

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

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

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

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

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

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

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