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

type CompanyCollectorOpts = CollectorQueryOptions<
  Prisma.CompanySelect,
  Prisma.CompanyInclude
>;

export default async (opts?: CompanyCollectorOpts) => {
  const args: Prisma.CompanyFindManyArgs = buildCollectorFindManyArgs<
    Prisma.CompanySelect,
    Prisma.CompanyInclude
  >(opts);

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

  return data;
};
