/**
 * Generated by orval. Do not edit manually.
 * O-replay - OpenAPI 3.0
 * O-replay Rest API
 */
import {
  useMutation
} from 'react-query';
import type {
  MutationFunction,
  UseMutationOptions,
  UseMutationResult
} from 'react-query';

import type {
  PostListRankingComputeStage200,
  PostListRankingComputeStageBody,
  PostListRankingComputeStageParams
} from '../../../domain/types/v1api';

import { orvalAxiosInstance } from '../../orval/orval-axios-instance';


type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];



/**
 * Add new only class list
 */
export const postListRankingComputeStage = (
    rankingID: string,
    eventID: string,
    stageID: string,
    postListRankingComputeStageBody: PostListRankingComputeStageBody,
    params?: PostListRankingComputeStageParams,
 options?: SecondParameter<typeof orvalAxiosInstance>,signal?: AbortSignal
) => {
      
      
      return orvalAxiosInstance<PostListRankingComputeStage200>(
      {url: `/api/v1/rankings/${rankingID}/events/${eventID}/stages/${stageID}/compute/`, method: 'POST',
      headers: {'Content-Type': 'application/json', },
      data: postListRankingComputeStageBody,
        params, signal
    },
      options);
    }
  


export const getPostListRankingComputeStageMutationOptions = <TError = unknown,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postListRankingComputeStage>>, TError,{rankingID: string;eventID: string;stageID: string;data: PostListRankingComputeStageBody;params?: PostListRankingComputeStageParams}, TContext>, request?: SecondParameter<typeof orvalAxiosInstance>}
): UseMutationOptions<Awaited<ReturnType<typeof postListRankingComputeStage>>, TError,{rankingID: string;eventID: string;stageID: string;data: PostListRankingComputeStageBody;params?: PostListRankingComputeStageParams}, TContext> => {

const mutationKey = ['postListRankingComputeStage'];
const {mutation: mutationOptions, request: requestOptions} = options ?
      options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ?
      options
      : {...options, mutation: {...options.mutation, mutationKey}}
      : {mutation: { mutationKey, }, request: undefined};

      


      const mutationFn: MutationFunction<Awaited<ReturnType<typeof postListRankingComputeStage>>, {rankingID: string;eventID: string;stageID: string;data: PostListRankingComputeStageBody;params?: PostListRankingComputeStageParams}> = (props) => {
          const {rankingID,eventID,stageID,data,params} = props ?? {};

          return  postListRankingComputeStage(rankingID,eventID,stageID,data,params,requestOptions)
        }

        


  return  { mutationFn, ...mutationOptions }}

    export type PostListRankingComputeStageMutationResult = NonNullable<Awaited<ReturnType<typeof postListRankingComputeStage>>>
    export type PostListRankingComputeStageMutationBody = PostListRankingComputeStageBody
    export type PostListRankingComputeStageMutationError = unknown

    export const usePostListRankingComputeStage = <TError = unknown,
    TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof postListRankingComputeStage>>, TError,{rankingID: string;eventID: string;stageID: string;data: PostListRankingComputeStageBody;params?: PostListRankingComputeStageParams}, TContext>, request?: SecondParameter<typeof orvalAxiosInstance>}
 ): UseMutationResult<
        Awaited<ReturnType<typeof postListRankingComputeStage>>,
        TError,
        {rankingID: string;eventID: string;stageID: string;data: PostListRankingComputeStageBody;params?: PostListRankingComputeStageParams},
        TContext
      > => {

      const mutationOptions = getPostListRankingComputeStageMutationOptions(options);

      return useMutation(mutationOptions);
    }
    