import axios from 'axios';
import { API_URL_ADDITIONAL_SERVICE } from '@/shared/api/api-url-additional-service';
import { resultify } from '@/shared/lib/resultify';
import { CBDCAxiosError } from '@/shared/@types/error';
import {
    ExtensionLinkPayWaitDeleteRespone
} from '../../model/types';
import {
    useMutation,
    UseMutationOptions
} from '@tanstack/react-query';
import { ExtensionLinkPayWaitDeleteParams } from '../../model/types';

export const extensionLinkPayWaitDelete = async (params: ExtensionLinkPayWaitDeleteParams)=> {
    return resultify(
        axios.post<ExtensionLinkPayWaitDeleteRespone>(API_URL_ADDITIONAL_SERVICE.extensionLinkPaymentWaitDelete(), params)
    );
};

export const useExtensionLinkPayWaitDeleteMutation = (options?: UseMutationOptions<ExtensionLinkPayWaitDeleteRespone, CBDCAxiosError, ExtensionLinkPayWaitDeleteParams>) => {
    const mutation = useMutation<ExtensionLinkPayWaitDeleteRespone, CBDCAxiosError, ExtensionLinkPayWaitDeleteParams>({
        ...options,
        mutationFn: (params: ExtensionLinkPayWaitDeleteParams) => extensionLinkPayWaitDelete(params),
    });

    return {
        ...mutation,
    };
};