import { prisma } from "../constants";
import { Prisma } from "../../generated/prisma/client";
import {
  buildCollectorFindManyArgs,
  CollectorQueryOptions,
} from "../helper/collectorQuery";

type ProductCollectorOpts = CollectorQueryOptions<
  Prisma.ProductCatalogSelect,
  Prisma.ProductCatalogInclude
>;

export default async (opts?: ProductCollectorOpts) => {
  const args: Prisma.ProductCatalogFindManyArgs = buildCollectorFindManyArgs<
    Prisma.ProductCatalogSelect,
    Prisma.ProductCatalogInclude
  >(opts);

  const data = await prisma.productCatalog.findMany(args);

  return data;
};
