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

export type GetCapabilitiesOkResponse = CapabilitiesResponse;

export type GetCapabilitiesErrorResponse = unknown;

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

export function getCapabilities(props: GetCapabilitiesProps): Promise<GetCapabilitiesOkResponse> {
  return fetcher<GetCapabilitiesOkResponse, unknown, unknown>({
    url: `/auth/capabilities`,
    method: 'GET',
    ...props
  });
}

/**
 * Returns capabilities that can be leveraged by frontend services to toggle certain features.
 */
export function useGetCapabilitiesQuery(
  props: GetCapabilitiesProps,
  options?: Omit<UseQueryOptions<GetCapabilitiesOkResponse, GetCapabilitiesErrorResponse>, 'queryKey' | 'queryFn'>
) {
  return useQuery<GetCapabilitiesOkResponse, GetCapabilitiesErrorResponse>(
    ['getCapabilities'],
    ({ signal }) => getCapabilities({ ...props, signal }),
    options
  );
}
