/* eslint-disable */
// This code is autogenerated using @harnessio/oats-cli.
// Please do not modify this code directly.
import { useQuery, UseQueryOptions } from '@tanstack/react-query';

import type { ProjectMember } from '../schemas/ProjectMember';
import { fetcher, FetcherOptions } from 'services/fetcher';

export interface GetProjectMembersQueryPathParams {
  project_id: string;
  state: 'accepted' | 'all' | 'not_accepted';
}

export type GetProjectMembersOkResponse = {
  data?: ProjectMember[];
};

export type GetProjectMembersErrorResponse = unknown;

export interface GetProjectMembersProps
  extends GetProjectMembersQueryPathParams,
    Omit<FetcherOptions<unknown, unknown>, 'url'> {}

export function getProjectMembers(props: GetProjectMembersProps): Promise<GetProjectMembersOkResponse> {
  return fetcher<GetProjectMembersOkResponse, unknown, unknown>({
    url: `/auth/get_project_members/${props.project_id}/${props.state}`,
    method: 'GET',
    ...props
  });
}

/**
 * This API is used to fetch members of the project based on the invitation state
 */
export function useGetProjectMembersQuery(
  props: GetProjectMembersProps,
  options?: Omit<UseQueryOptions<GetProjectMembersOkResponse, GetProjectMembersErrorResponse>, 'queryKey' | 'queryFn'>
) {
  return useQuery<GetProjectMembersOkResponse, GetProjectMembersErrorResponse>(
    ['getProjectMembers', props.project_id, props.state],
    ({ signal }) => getProjectMembers({ ...props, signal }),
    options
  );
}
