import type { UIMatch } from "@remix-run/react";
import type { MatchedProject } from "./useProject";
import { useOptionalProject } from "./useProject";

export type ProjectJobEnvironment = MatchedProject["environments"][number];

export function useEnvironments(matches?: UIMatch[]) {
  const project = useOptionalProject(matches);
  if (!project) return;

  return project.environments;
}
