/* 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 { fetcher, FetcherOptions } from 'services/fetcher';

export interface GetProjectRoleQueryPathParams {
  project_id: string;
}

export type GetProjectRoleOkResponse = {
  role?: string;
};

export type GetProjectRoleErrorResponse = unknown;

export interface GetProjectRoleProps
  extends GetProjectRoleQueryPathParams,
    Omit<FetcherOptions<unknown, unknown>, 'url'> {}

export function getProjectRole(props: GetProjectRoleProps): Promise<GetProjectRoleOkResponse> {
  return fetcher<GetProjectRoleOkResponse, unknown, unknown>({
    url: `/auth/get_project_role/${props.project_id}`,
    method: 'GET',
    ...props
  });
}

/**
 * This API is used to fetch the role of the user in the given project
 *
 */
export function useGetProjectRoleQuery(
  props: GetProjectRoleProps,
  options?: Omit<UseQueryOptions<GetProjectRoleOkResponse, GetProjectRoleErrorResponse>, 'queryKey' | 'queryFn'>
) {
  return useQuery<GetProjectRoleOkResponse, GetProjectRoleErrorResponse>(
    ['getProjectRole', props.project_id],
    ({ signal }) => getProjectRole({ ...props, signal }),
    options
  );
}
