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

type OpportunityCollectorOpts = CollectorQueryOptions<
  Prisma.OpportunitySelect,
  Prisma.OpportunityInclude
>;

export default async (opts?: OpportunityCollectorOpts) => {
  const args: Prisma.OpportunityFindManyArgs = buildCollectorFindManyArgs<
    Prisma.OpportunitySelect,
    Prisma.OpportunityInclude
  >(opts);

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

  return data;
};
