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

import type { DeclineInvitationBodyRequestBody } from '../requestBodies/DeclineInvitationBodyRequestBody';
import { fetcher, FetcherOptions } from 'services/fetcher';

export type RemoveInvitationRequestBody = DeclineInvitationBodyRequestBody;

export type RemoveInvitationOkResponse = {
  message?: string;
};

export type RemoveInvitationErrorResponse = unknown;

export interface RemoveInvitationProps extends Omit<FetcherOptions<unknown, RemoveInvitationRequestBody>, 'url'> {
  body: RemoveInvitationRequestBody;
}

export function removeInvitation(props: RemoveInvitationProps): Promise<RemoveInvitationOkResponse> {
  return fetcher<RemoveInvitationOkResponse, unknown, RemoveInvitationRequestBody>({
    url: `/auth/remove_invitation`,
    method: 'POST',
    ...props
  });
}

export type RemoveInvitationMutationProps<T extends keyof RemoveInvitationProps> = Omit<RemoveInvitationProps, T> &
  Partial<Pick<RemoveInvitationProps, T>>;

/**
 * This API is used to revoke a project invite or remove a project member
 */
export function useRemoveInvitationMutation<T extends keyof RemoveInvitationProps>(
  props: Pick<Partial<RemoveInvitationProps>, T>,
  options?: Omit<
    UseMutationOptions<RemoveInvitationOkResponse, RemoveInvitationErrorResponse, RemoveInvitationMutationProps<T>>,
    'mutationKey' | 'mutationFn'
  >
) {
  return useMutation<RemoveInvitationOkResponse, RemoveInvitationErrorResponse, RemoveInvitationMutationProps<T>>(
    (mutateProps: RemoveInvitationMutationProps<T>) =>
      removeInvitation({ ...props, ...mutateProps } as RemoveInvitationProps),
    options
  );
}
