// This file is auto-generated by @hey-api/openapi-ts

import {
    infiniteQueryOptions,
    queryOptions,
    type DefaultError,
    type InfiniteData,
    type UseMutationOptions,
} from "@tanstack/react-query";
import type { AxiosError } from "axios";
import { client as _heyApiClient } from "../client.gen";
import {
    addAttributeToModule,
    addKitToDeal,
    addKitToDealProduct,
    createAttribute,
    createBarcodeTemplate,
    createBoard,
    createClient,
    createDeal,
    createDealGroup,
    createDealProduct,
    createDealProductService,
    createDealService,
    createDealTag,
    createMarketplace,
    createModule,
    createProduct,
    createProject,
    createService,
    createServiceCategory,
    createServicesKit,
    createStatus,
    deleteAttribute,
    deleteBarcodeTemplate,
    deleteBoard,
    deleteClient,
    deleteDeal,
    deleteDealGroup,
    deleteDealProduct,
    deleteDealProductService,
    deleteDealService,
    deleteDealTag,
    deleteMarketplace,
    deleteModule,
    deleteProduct,
    deleteProductBarcodeImage,
    deleteProject,
    deleteService,
    deleteServiceCategory,
    deleteServicesKit,
    deleteStatus,
    duplicateProductServices,
    getAttributes,
    getAttributeTypes,
    getAttrSelectOptions,
    getAttrSelects,
    getBarcodeTemplateAttributes,
    getBarcodeTemplates,
    getBarcodeTemplateSizes,
    getBaseMarketplaces,
    getBoards,
    getClients,
    getDealBarcodesPdf,
    getDealModuleAttributes,
    getDealProducts,
    getDeals,
    getDealServices,
    getDealTagColors,
    getDealTags,
    getMarketplaces,
    getModules,
    getModulesWithAttributes,
    getModuleWithAttributes,
    getProductBarcodePdf,
    getProducts,
    getProjects,
    getServiceCategories,
    getServices,
    getServicesKits,
    getStatuses,
    getStatusHistory,
    removeAttributeFromModule,
    switchDealTag,
    updateAttribute,
    updateAttributeLabel,
    updateBarcodeTemplate,
    updateBoard,
    updateClient,
    updateDeal,
    updateDealGroup,
    updateDealModuleAttributes,
    updateDealProduct,
    updateDealProductService,
    updateDealService,
    updateDealsInGroup,
    updateDealTag,
    updateMarketplace,
    updateModule,
    updateProduct,
    updateProject,
    updateService,
    updateServiceCategory,
    updateServicesKit,
    updateStatus,
    uploadProductBarcodeImage,
    uploadProductImage,
    type Options,
} from "../sdk.gen";
import type {
    AddAttributeToModuleData,
    AddAttributeToModuleError,
    AddAttributeToModuleResponse,
    AddKitToDealData,
    AddKitToDealError,
    AddKitToDealProductData,
    AddKitToDealProductError,
    AddKitToDealProductResponse,
    AddKitToDealResponse,
    CreateAttributeData,
    CreateAttributeError,
    CreateAttributeResponse2,
    CreateBarcodeTemplateData,
    CreateBarcodeTemplateError,
    CreateBarcodeTemplateResponse2,
    CreateBoardData,
    CreateBoardError,
    CreateBoardResponse2,
    CreateClientData,
    CreateClientError,
    CreateClientResponse2,
    CreateDealData,
    CreateDealError,
    CreateDealGroupData,
    CreateDealGroupError,
    CreateDealGroupResponse2,
    CreateDealProductData,
    CreateDealProductError,
    CreateDealProductResponse2,
    CreateDealProductServiceData,
    CreateDealProductServiceError,
    CreateDealProductServiceResponse,
    CreateDealResponse2,
    CreateDealServiceData,
    CreateDealServiceError,
    CreateDealServiceResponse2,
    CreateDealTagData,
    CreateDealTagError,
    CreateDealTagResponse2,
    CreateMarketplaceData,
    CreateMarketplaceError,
    CreateMarketplaceResponse2,
    CreateModuleData,
    CreateModuleError,
    CreateModuleResponse2,
    CreateProductData,
    CreateProductError,
    CreateProductResponse2,
    CreateProjectData,
    CreateProjectError,
    CreateProjectResponse2,
    CreateServiceCategoryData,
    CreateServiceCategoryError,
    CreateServiceCategoryResponse2,
    CreateServiceData,
    CreateServiceError,
    CreateServiceResponse2,
    CreateServicesKitData,
    CreateServicesKitError,
    CreateServicesKitResponse2,
    CreateStatusData,
    CreateStatusError,
    CreateStatusResponse2,
    DeleteAttributeData,
    DeleteAttributeError,
    DeleteAttributeResponse2,
    DeleteBarcodeTemplateData,
    DeleteBarcodeTemplateError,
    DeleteBarcodeTemplateResponse2,
    DeleteBoardData,
    DeleteBoardError,
    DeleteBoardResponse2,
    DeleteClientData,
    DeleteClientError,
    DeleteClientResponse2,
    DeleteDealData,
    DeleteDealError,
    DeleteDealGroupData,
    DeleteDealGroupError,
    DeleteDealGroupResponse2,
    DeleteDealProductData,
    DeleteDealProductError,
    DeleteDealProductResponse2,
    DeleteDealProductServiceData,
    DeleteDealProductServiceError,
    DeleteDealProductServiceResponse,
    DeleteDealResponse2,
    DeleteDealServiceData,
    DeleteDealServiceError,
    DeleteDealServiceResponse2,
    DeleteDealTagData,
    DeleteDealTagError,
    DeleteDealTagResponse2,
    DeleteMarketplaceData,
    DeleteMarketplaceError,
    DeleteMarketplaceResponse2,
    DeleteModuleData,
    DeleteModuleError,
    DeleteModuleResponse2,
    DeleteProductBarcodeImageData,
    DeleteProductBarcodeImageError,
    DeleteProductBarcodeImageResponse,
    DeleteProductData,
    DeleteProductError,
    DeleteProductResponse2,
    DeleteProjectData,
    DeleteProjectError,
    DeleteProjectResponse2,
    DeleteServiceCategoryData,
    DeleteServiceCategoryError,
    DeleteServiceCategoryResponse2,
    DeleteServiceData,
    DeleteServiceError,
    DeleteServiceResponse2,
    DeleteServicesKitData,
    DeleteServicesKitError,
    DeleteServicesKitResponse2,
    DeleteStatusData,
    DeleteStatusError,
    DeleteStatusResponse2,
    DuplicateProductServicesData,
    DuplicateProductServicesError,
    DuplicateProductServicesResponse,
    GetAttributesData,
    GetAttributeTypesData,
    GetAttrSelectOptionsData,
    GetAttrSelectsData,
    GetBarcodeTemplateAttributesData,
    GetBarcodeTemplatesData,
    GetBarcodeTemplateSizesData,
    GetBaseMarketplacesData,
    GetBoardsData,
    GetClientsData,
    GetDealBarcodesPdfData,
    GetDealBarcodesPdfError,
    GetDealBarcodesPdfResponse2,
    GetDealModuleAttributesData,
    GetDealProductsData,
    GetDealsData,
    GetDealsError,
    GetDealServicesData,
    GetDealsResponse2,
    GetDealTagColorsData,
    GetDealTagColorsResponse,
    GetDealTagsData,
    GetMarketplacesData,
    GetModulesData,
    GetModulesWithAttributesData,
    GetModuleWithAttributesData,
    GetProductBarcodePdfData,
    GetProductBarcodePdfError,
    GetProductBarcodePdfResponse2,
    GetProductsData,
    GetProductsError,
    GetProductsResponse2,
    GetProjectsData,
    GetServiceCategoriesData,
    GetServicesData,
    GetServicesKitsData,
    GetStatusesData,
    GetStatusHistoryData,
    RemoveAttributeFromModuleData,
    RemoveAttributeFromModuleError,
    RemoveAttributeFromModuleResponse,
    SwitchDealTagData,
    SwitchDealTagError,
    SwitchDealTagResponse2,
    UpdateAttributeData,
    UpdateAttributeError,
    UpdateAttributeLabelData,
    UpdateAttributeLabelError,
    UpdateAttributeLabelResponse2,
    UpdateAttributeResponse2,
    UpdateBarcodeTemplateData,
    UpdateBarcodeTemplateError,
    UpdateBarcodeTemplateResponse2,
    UpdateBoardData,
    UpdateBoardError,
    UpdateBoardResponse2,
    UpdateClientData,
    UpdateClientError,
    UpdateClientResponse2,
    UpdateDealData,
    UpdateDealError,
    UpdateDealGroupData,
    UpdateDealGroupError,
    UpdateDealGroupResponse2,
    UpdateDealModuleAttributesData,
    UpdateDealModuleAttributesError,
    UpdateDealModuleAttributesResponse2,
    UpdateDealProductData,
    UpdateDealProductError,
    UpdateDealProductResponse2,
    UpdateDealProductServiceData,
    UpdateDealProductServiceError,
    UpdateDealProductServiceResponse,
    UpdateDealResponse2,
    UpdateDealServiceData,
    UpdateDealServiceError,
    UpdateDealServiceResponse2,
    UpdateDealsInGroupData,
    UpdateDealsInGroupError,
    UpdateDealsInGroupResponse2,
    UpdateDealTagData,
    UpdateDealTagError,
    UpdateDealTagResponse2,
    UpdateMarketplaceData,
    UpdateMarketplaceError,
    UpdateMarketplaceResponse2,
    UpdateModuleData,
    UpdateModuleError,
    UpdateModuleResponse,
    UpdateProductData,
    UpdateProductError,
    UpdateProductResponse2,
    UpdateProjectData,
    UpdateProjectError,
    UpdateProjectResponse2,
    UpdateServiceCategoryData,
    UpdateServiceCategoryError,
    UpdateServiceCategoryResponse2,
    UpdateServiceData,
    UpdateServiceError,
    UpdateServiceResponse2,
    UpdateServicesKitData,
    UpdateServicesKitError,
    UpdateServicesKitResponse2,
    UpdateStatusData,
    UpdateStatusError,
    UpdateStatusResponse2,
    UploadProductBarcodeImageData,
    UploadProductBarcodeImageError,
    UploadProductBarcodeImageResponse,
    UploadProductImageData,
    UploadProductImageError,
    UploadProductImageResponse,
} from "../types.gen";

export type QueryKey<TOptions extends Options> = [
    Pick<TOptions, "baseURL" | "body" | "headers" | "path" | "query"> & {
        _id: string;
        _infinite?: boolean;
    },
];

const createQueryKey = <TOptions extends Options>(
    id: string,
    options?: TOptions,
    infinite?: boolean
): [QueryKey<TOptions>[0]] => {
    const params: QueryKey<TOptions>[0] = {
        _id: id,
        baseURL:
            options?.baseURL ||
            (options?.client ?? _heyApiClient).getConfig().baseURL,
    } as QueryKey<TOptions>[0];
    if (infinite) {
        params._infinite = infinite;
    }
    if (options?.body) {
        params.body = options.body;
    }
    if (options?.headers) {
        params.headers = options.headers;
    }
    if (options?.path) {
        params.path = options.path;
    }
    if (options?.query) {
        params.query = options.query;
    }
    return [params];
};

export const getAttrSelectsQueryKey = (options?: Options<GetAttrSelectsData>) =>
    createQueryKey("getAttrSelects", options);

/**
 * Get Attr Selects
 */
export const getAttrSelectsOptions = (
    options?: Options<GetAttrSelectsData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getAttrSelects({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getAttrSelectsQueryKey(options),
    });
};

export const getAttrSelectOptionsQueryKey = (
    options: Options<GetAttrSelectOptionsData>
) => createQueryKey("getAttrSelectOptions", options);

/**
 * Get Attr Select Options
 */
export const getAttrSelectOptionsOptions = (
    options: Options<GetAttrSelectOptionsData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getAttrSelectOptions({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getAttrSelectOptionsQueryKey(options),
    });
};

export const getAttributesQueryKey = (options?: Options<GetAttributesData>) =>
    createQueryKey("getAttributes", options);

/**
 * Get Attributes
 */
export const getAttributesOptions = (options?: Options<GetAttributesData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getAttributes({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getAttributesQueryKey(options),
    });
};

export const createAttributeQueryKey = (
    options: Options<CreateAttributeData>
) => createQueryKey("createAttribute", options);

/**
 * Create Attribute
 */
export const createAttributeOptions = (
    options: Options<CreateAttributeData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await createAttribute({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: createAttributeQueryKey(options),
    });
};

/**
 * Create Attribute
 */
export const createAttributeMutation = (
    options?: Partial<Options<CreateAttributeData>>
): UseMutationOptions<
    CreateAttributeResponse2,
    AxiosError<CreateAttributeError>,
    Options<CreateAttributeData>
> => {
    const mutationOptions: UseMutationOptions<
        CreateAttributeResponse2,
        AxiosError<CreateAttributeError>,
        Options<CreateAttributeData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await createAttribute({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Attribute
 */
export const deleteAttributeMutation = (
    options?: Partial<Options<DeleteAttributeData>>
): UseMutationOptions<
    DeleteAttributeResponse2,
    AxiosError<DeleteAttributeError>,
    Options<DeleteAttributeData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteAttributeResponse2,
        AxiosError<DeleteAttributeError>,
        Options<DeleteAttributeData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteAttribute({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Update Attribute
 */
export const updateAttributeMutation = (
    options?: Partial<Options<UpdateAttributeData>>
): UseMutationOptions<
    UpdateAttributeResponse2,
    AxiosError<UpdateAttributeError>,
    Options<UpdateAttributeData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateAttributeResponse2,
        AxiosError<UpdateAttributeError>,
        Options<UpdateAttributeData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateAttribute({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const updateAttributeLabelQueryKey = (
    options: Options<UpdateAttributeLabelData>
) => createQueryKey("updateAttributeLabel", options);

/**
 * Update Attribute Label
 */
export const updateAttributeLabelOptions = (
    options: Options<UpdateAttributeLabelData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await updateAttributeLabel({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: updateAttributeLabelQueryKey(options),
    });
};

/**
 * Update Attribute Label
 */
export const updateAttributeLabelMutation = (
    options?: Partial<Options<UpdateAttributeLabelData>>
): UseMutationOptions<
    UpdateAttributeLabelResponse2,
    AxiosError<UpdateAttributeLabelError>,
    Options<UpdateAttributeLabelData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateAttributeLabelResponse2,
        AxiosError<UpdateAttributeLabelError>,
        Options<UpdateAttributeLabelData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateAttributeLabel({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getAttributeTypesQueryKey = (
    options?: Options<GetAttributeTypesData>
) => createQueryKey("getAttributeTypes", options);

/**
 * Get Attribute Types
 */
export const getAttributeTypesOptions = (
    options?: Options<GetAttributeTypesData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getAttributeTypes({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getAttributeTypesQueryKey(options),
    });
};

export const getDealModuleAttributesQueryKey = (
    options: Options<GetDealModuleAttributesData>
) => createQueryKey("getDealModuleAttributes", options);

/**
 * Get Deal Module Attributes
 */
export const getDealModuleAttributesOptions = (
    options: Options<GetDealModuleAttributesData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getDealModuleAttributes({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getDealModuleAttributesQueryKey(options),
    });
};

export const updateDealModuleAttributesQueryKey = (
    options: Options<UpdateDealModuleAttributesData>
) => createQueryKey("updateDealModuleAttributes", options);

/**
 * Update Deal Module Attributes
 */
export const updateDealModuleAttributesOptions = (
    options: Options<UpdateDealModuleAttributesData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await updateDealModuleAttributes({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: updateDealModuleAttributesQueryKey(options),
    });
};

/**
 * Update Deal Module Attributes
 */
export const updateDealModuleAttributesMutation = (
    options?: Partial<Options<UpdateDealModuleAttributesData>>
): UseMutationOptions<
    UpdateDealModuleAttributesResponse2,
    AxiosError<UpdateDealModuleAttributesError>,
    Options<UpdateDealModuleAttributesData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateDealModuleAttributesResponse2,
        AxiosError<UpdateDealModuleAttributesError>,
        Options<UpdateDealModuleAttributesData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateDealModuleAttributes({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getBoardsQueryKey = (options: Options<GetBoardsData>) =>
    createQueryKey("getBoards", options);

/**
 * Get Boards
 */
export const getBoardsOptions = (options: Options<GetBoardsData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getBoards({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getBoardsQueryKey(options),
    });
};

export const createBoardQueryKey = (options: Options<CreateBoardData>) =>
    createQueryKey("createBoard", options);

/**
 * Create Board
 */
export const createBoardOptions = (options: Options<CreateBoardData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await createBoard({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: createBoardQueryKey(options),
    });
};

/**
 * Create Board
 */
export const createBoardMutation = (
    options?: Partial<Options<CreateBoardData>>
): UseMutationOptions<
    CreateBoardResponse2,
    AxiosError<CreateBoardError>,
    Options<CreateBoardData>
> => {
    const mutationOptions: UseMutationOptions<
        CreateBoardResponse2,
        AxiosError<CreateBoardError>,
        Options<CreateBoardData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await createBoard({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Board
 */
export const deleteBoardMutation = (
    options?: Partial<Options<DeleteBoardData>>
): UseMutationOptions<
    DeleteBoardResponse2,
    AxiosError<DeleteBoardError>,
    Options<DeleteBoardData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteBoardResponse2,
        AxiosError<DeleteBoardError>,
        Options<DeleteBoardData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteBoard({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Update Board
 */
export const updateBoardMutation = (
    options?: Partial<Options<UpdateBoardData>>
): UseMutationOptions<
    UpdateBoardResponse2,
    AxiosError<UpdateBoardError>,
    Options<UpdateBoardData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateBoardResponse2,
        AxiosError<UpdateBoardError>,
        Options<UpdateBoardData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateBoard({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getDealsQueryKey = (options?: Options<GetDealsData>) =>
    createQueryKey("getDeals", options);

/**
 * Get Deals
 */
export const getDealsOptions = (options?: Options<GetDealsData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getDeals({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getDealsQueryKey(options),
    });
};

const createInfiniteParams = <
    K extends Pick<QueryKey<Options>[0], "body" | "headers" | "path" | "query">,
>(
    queryKey: QueryKey<Options>,
    page: K
) => {
    const params = {
        ...queryKey[0],
    };
    if (page.body) {
        params.body = {
            ...(queryKey[0].body as any),
            ...(page.body as any),
        };
    }
    if (page.headers) {
        params.headers = {
            ...queryKey[0].headers,
            ...page.headers,
        };
    }
    if (page.path) {
        params.path = {
            ...(queryKey[0].path as any),
            ...(page.path as any),
        };
    }
    if (page.query) {
        params.query = {
            ...(queryKey[0].query as any),
            ...(page.query as any),
        };
    }
    return params as unknown as typeof page;
};

export const getDealsInfiniteQueryKey = (
    options?: Options<GetDealsData>
): QueryKey<Options<GetDealsData>> => createQueryKey("getDeals", options, true);

/**
 * Get Deals
 */
export const getDealsInfiniteOptions = (options?: Options<GetDealsData>) => {
    return infiniteQueryOptions<
        GetDealsResponse2,
        AxiosError<GetDealsError>,
        InfiniteData<GetDealsResponse2>,
        QueryKey<Options<GetDealsData>>,
        | number
        | null
        | Pick<
              QueryKey<Options<GetDealsData>>[0],
              "body" | "headers" | "path" | "query"
          >
    >(
        // @ts-ignore
        {
            queryFn: async ({ pageParam, queryKey, signal }) => {
                // @ts-ignore
                const page: Pick<
                    QueryKey<Options<GetDealsData>>[0],
                    "body" | "headers" | "path" | "query"
                > =
                    typeof pageParam === "object"
                        ? pageParam
                        : {
                              query: {
                                  page: pageParam,
                              },
                          };
                const params = createInfiniteParams(queryKey, page);
                const { data } = await getDeals({
                    ...options,
                    ...params,
                    signal,
                    throwOnError: true,
                });
                return data;
            },
            queryKey: getDealsInfiniteQueryKey(options),
        }
    );
};

export const createDealQueryKey = (options: Options<CreateDealData>) =>
    createQueryKey("createDeal", options);

/**
 * Create Deal
 */
export const createDealOptions = (options: Options<CreateDealData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await createDeal({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: createDealQueryKey(options),
    });
};

/**
 * Create Deal
 */
export const createDealMutation = (
    options?: Partial<Options<CreateDealData>>
): UseMutationOptions<
    CreateDealResponse2,
    AxiosError<CreateDealError>,
    Options<CreateDealData>
> => {
    const mutationOptions: UseMutationOptions<
        CreateDealResponse2,
        AxiosError<CreateDealError>,
        Options<CreateDealData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await createDeal({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Deal
 */
export const deleteDealMutation = (
    options?: Partial<Options<DeleteDealData>>
): UseMutationOptions<
    DeleteDealResponse2,
    AxiosError<DeleteDealError>,
    Options<DeleteDealData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteDealResponse2,
        AxiosError<DeleteDealError>,
        Options<DeleteDealData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteDeal({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Update Deal
 */
export const updateDealMutation = (
    options?: Partial<Options<UpdateDealData>>
): UseMutationOptions<
    UpdateDealResponse2,
    AxiosError<UpdateDealError>,
    Options<UpdateDealData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateDealResponse2,
        AxiosError<UpdateDealError>,
        Options<UpdateDealData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateDeal({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Group
 */
export const deleteDealGroupMutation = (
    options?: Partial<Options<DeleteDealGroupData>>
): UseMutationOptions<
    DeleteDealGroupResponse2,
    AxiosError<DeleteDealGroupError>,
    Options<DeleteDealGroupData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteDealGroupResponse2,
        AxiosError<DeleteDealGroupError>,
        Options<DeleteDealGroupData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteDealGroup({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Update Group
 */
export const updateDealGroupMutation = (
    options?: Partial<Options<UpdateDealGroupData>>
): UseMutationOptions<
    UpdateDealGroupResponse2,
    AxiosError<UpdateDealGroupError>,
    Options<UpdateDealGroupData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateDealGroupResponse2,
        AxiosError<UpdateDealGroupError>,
        Options<UpdateDealGroupData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateDealGroup({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const createDealGroupQueryKey = (
    options: Options<CreateDealGroupData>
) => createQueryKey("createDealGroup", options);

/**
 * Create Group
 */
export const createDealGroupOptions = (
    options: Options<CreateDealGroupData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await createDealGroup({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: createDealGroupQueryKey(options),
    });
};

/**
 * Create Group
 */
export const createDealGroupMutation = (
    options?: Partial<Options<CreateDealGroupData>>
): UseMutationOptions<
    CreateDealGroupResponse2,
    AxiosError<CreateDealGroupError>,
    Options<CreateDealGroupData>
> => {
    const mutationOptions: UseMutationOptions<
        CreateDealGroupResponse2,
        AxiosError<CreateDealGroupError>,
        Options<CreateDealGroupData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await createDealGroup({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const updateDealsInGroupQueryKey = (
    options: Options<UpdateDealsInGroupData>
) => createQueryKey("updateDealsInGroup", options);

/**
 * Update Deals In Group
 */
export const updateDealsInGroupOptions = (
    options: Options<UpdateDealsInGroupData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await updateDealsInGroup({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: updateDealsInGroupQueryKey(options),
    });
};

/**
 * Update Deals In Group
 */
export const updateDealsInGroupMutation = (
    options?: Partial<Options<UpdateDealsInGroupData>>
): UseMutationOptions<
    UpdateDealsInGroupResponse2,
    AxiosError<UpdateDealsInGroupError>,
    Options<UpdateDealsInGroupData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateDealsInGroupResponse2,
        AxiosError<UpdateDealsInGroupError>,
        Options<UpdateDealsInGroupData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateDealsInGroup({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getDealTagsQueryKey = (options: Options<GetDealTagsData>) =>
    createQueryKey("getDealTags", options);

/**
 * Get Deal Tags
 */
export const getDealTagsOptions = (options: Options<GetDealTagsData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getDealTags({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getDealTagsQueryKey(options),
    });
};

export const createDealTagQueryKey = (options: Options<CreateDealTagData>) =>
    createQueryKey("createDealTag", options);

/**
 * Create Deal Tag
 */
export const createDealTagOptions = (options: Options<CreateDealTagData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await createDealTag({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: createDealTagQueryKey(options),
    });
};

/**
 * Create Deal Tag
 */
export const createDealTagMutation = (
    options?: Partial<Options<CreateDealTagData>>
): UseMutationOptions<
    CreateDealTagResponse2,
    AxiosError<CreateDealTagError>,
    Options<CreateDealTagData>
> => {
    const mutationOptions: UseMutationOptions<
        CreateDealTagResponse2,
        AxiosError<CreateDealTagError>,
        Options<CreateDealTagData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await createDealTag({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Deal Tag
 */
export const deleteDealTagMutation = (
    options?: Partial<Options<DeleteDealTagData>>
): UseMutationOptions<
    DeleteDealTagResponse2,
    AxiosError<DeleteDealTagError>,
    Options<DeleteDealTagData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteDealTagResponse2,
        AxiosError<DeleteDealTagError>,
        Options<DeleteDealTagData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteDealTag({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Update Deal Tag
 */
export const updateDealTagMutation = (
    options?: Partial<Options<UpdateDealTagData>>
): UseMutationOptions<
    UpdateDealTagResponse2,
    AxiosError<UpdateDealTagError>,
    Options<UpdateDealTagData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateDealTagResponse2,
        AxiosError<UpdateDealTagError>,
        Options<UpdateDealTagData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateDealTag({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const switchDealTagQueryKey = (options: Options<SwitchDealTagData>) =>
    createQueryKey("switchDealTag", options);

/**
 * Switch Deal Tag
 */
export const switchDealTagOptions = (options: Options<SwitchDealTagData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await switchDealTag({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: switchDealTagQueryKey(options),
    });
};

/**
 * Switch Deal Tag
 */
export const switchDealTagMutation = (
    options?: Partial<Options<SwitchDealTagData>>
): UseMutationOptions<
    SwitchDealTagResponse2,
    AxiosError<SwitchDealTagError>,
    Options<SwitchDealTagData>
> => {
    const mutationOptions: UseMutationOptions<
        SwitchDealTagResponse2,
        AxiosError<SwitchDealTagError>,
        Options<SwitchDealTagData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await switchDealTag({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getDealTagColorsQueryKey = (
    options?: Options<GetDealTagColorsData>
) => createQueryKey("getDealTagColors", options);

/**
 * Get Deal Tag Colors
 */
export const getDealTagColorsOptions = (
    options?: Options<GetDealTagColorsData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getDealTagColors({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getDealTagColorsQueryKey(options),
    });
};

/**
 * Get Deal Tag Colors
 */
export const getDealTagColorsMutation = (
    options?: Partial<Options<GetDealTagColorsData>>
): UseMutationOptions<
    GetDealTagColorsResponse,
    AxiosError<DefaultError>,
    Options<GetDealTagColorsData>
> => {
    const mutationOptions: UseMutationOptions<
        GetDealTagColorsResponse,
        AxiosError<DefaultError>,
        Options<GetDealTagColorsData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await getDealTagColors({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getModulesQueryKey = (options?: Options<GetModulesData>) =>
    createQueryKey("getModules", options);

/**
 * Get Modules
 */
export const getModulesOptions = (options?: Options<GetModulesData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getModules({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getModulesQueryKey(options),
    });
};

export const createModuleQueryKey = (options: Options<CreateModuleData>) =>
    createQueryKey("createModule", options);

/**
 * Create Module
 */
export const createModuleOptions = (options: Options<CreateModuleData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await createModule({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: createModuleQueryKey(options),
    });
};

/**
 * Create Module
 */
export const createModuleMutation = (
    options?: Partial<Options<CreateModuleData>>
): UseMutationOptions<
    CreateModuleResponse2,
    AxiosError<CreateModuleError>,
    Options<CreateModuleData>
> => {
    const mutationOptions: UseMutationOptions<
        CreateModuleResponse2,
        AxiosError<CreateModuleError>,
        Options<CreateModuleData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await createModule({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getModulesWithAttributesQueryKey = (
    options?: Options<GetModulesWithAttributesData>
) => createQueryKey("getModulesWithAttributes", options);

/**
 * Get Modules With Attributes
 */
export const getModulesWithAttributesOptions = (
    options?: Options<GetModulesWithAttributesData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getModulesWithAttributes({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getModulesWithAttributesQueryKey(options),
    });
};

export const getModuleWithAttributesQueryKey = (
    options: Options<GetModuleWithAttributesData>
) => createQueryKey("getModuleWithAttributes", options);

/**
 * Get Module With Attributes
 */
export const getModuleWithAttributesOptions = (
    options: Options<GetModuleWithAttributesData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getModuleWithAttributes({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getModuleWithAttributesQueryKey(options),
    });
};

/**
 * Update Module Common Info
 */
export const updateModuleMutation = (
    options?: Partial<Options<UpdateModuleData>>
): UseMutationOptions<
    UpdateModuleResponse,
    AxiosError<UpdateModuleError>,
    Options<UpdateModuleData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateModuleResponse,
        AxiosError<UpdateModuleError>,
        Options<UpdateModuleData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateModule({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Module
 */
export const deleteModuleMutation = (
    options?: Partial<Options<DeleteModuleData>>
): UseMutationOptions<
    DeleteModuleResponse2,
    AxiosError<DeleteModuleError>,
    Options<DeleteModuleData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteModuleResponse2,
        AxiosError<DeleteModuleError>,
        Options<DeleteModuleData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteModule({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Remove Attribute From Module
 */
export const removeAttributeFromModuleMutation = (
    options?: Partial<Options<RemoveAttributeFromModuleData>>
): UseMutationOptions<
    RemoveAttributeFromModuleResponse,
    AxiosError<RemoveAttributeFromModuleError>,
    Options<RemoveAttributeFromModuleData>
> => {
    const mutationOptions: UseMutationOptions<
        RemoveAttributeFromModuleResponse,
        AxiosError<RemoveAttributeFromModuleError>,
        Options<RemoveAttributeFromModuleData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await removeAttributeFromModule({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const addAttributeToModuleQueryKey = (
    options: Options<AddAttributeToModuleData>
) => createQueryKey("addAttributeToModule", options);

/**
 * Add Attribute To Module
 */
export const addAttributeToModuleOptions = (
    options: Options<AddAttributeToModuleData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await addAttributeToModule({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: addAttributeToModuleQueryKey(options),
    });
};

/**
 * Add Attribute To Module
 */
export const addAttributeToModuleMutation = (
    options?: Partial<Options<AddAttributeToModuleData>>
): UseMutationOptions<
    AddAttributeToModuleResponse,
    AxiosError<AddAttributeToModuleError>,
    Options<AddAttributeToModuleData>
> => {
    const mutationOptions: UseMutationOptions<
        AddAttributeToModuleResponse,
        AxiosError<AddAttributeToModuleError>,
        Options<AddAttributeToModuleData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await addAttributeToModule({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getClientsQueryKey = (options?: Options<GetClientsData>) =>
    createQueryKey("getClients", options);

/**
 * Get Clients
 */
export const getClientsOptions = (options?: Options<GetClientsData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getClients({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getClientsQueryKey(options),
    });
};

export const createClientQueryKey = (options: Options<CreateClientData>) =>
    createQueryKey("createClient", options);

/**
 * Create Client
 */
export const createClientOptions = (options: Options<CreateClientData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await createClient({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: createClientQueryKey(options),
    });
};

/**
 * Create Client
 */
export const createClientMutation = (
    options?: Partial<Options<CreateClientData>>
): UseMutationOptions<
    CreateClientResponse2,
    AxiosError<CreateClientError>,
    Options<CreateClientData>
> => {
    const mutationOptions: UseMutationOptions<
        CreateClientResponse2,
        AxiosError<CreateClientError>,
        Options<CreateClientData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await createClient({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Product
 */
export const deleteClientMutation = (
    options?: Partial<Options<DeleteClientData>>
): UseMutationOptions<
    DeleteClientResponse2,
    AxiosError<DeleteClientError>,
    Options<DeleteClientData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteClientResponse2,
        AxiosError<DeleteClientError>,
        Options<DeleteClientData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteClient({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Update Client
 */
export const updateClientMutation = (
    options?: Partial<Options<UpdateClientData>>
): UseMutationOptions<
    UpdateClientResponse2,
    AxiosError<UpdateClientError>,
    Options<UpdateClientData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateClientResponse2,
        AxiosError<UpdateClientError>,
        Options<UpdateClientData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateClient({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getBarcodeTemplatesQueryKey = (
    options?: Options<GetBarcodeTemplatesData>
) => createQueryKey("getBarcodeTemplates", options);

/**
 * Get Barcode Templates
 */
export const getBarcodeTemplatesOptions = (
    options?: Options<GetBarcodeTemplatesData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getBarcodeTemplates({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getBarcodeTemplatesQueryKey(options),
    });
};

export const createBarcodeTemplateQueryKey = (
    options: Options<CreateBarcodeTemplateData>
) => createQueryKey("createBarcodeTemplate", options);

/**
 * Create Barcode Template
 */
export const createBarcodeTemplateOptions = (
    options: Options<CreateBarcodeTemplateData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await createBarcodeTemplate({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: createBarcodeTemplateQueryKey(options),
    });
};

/**
 * Create Barcode Template
 */
export const createBarcodeTemplateMutation = (
    options?: Partial<Options<CreateBarcodeTemplateData>>
): UseMutationOptions<
    CreateBarcodeTemplateResponse2,
    AxiosError<CreateBarcodeTemplateError>,
    Options<CreateBarcodeTemplateData>
> => {
    const mutationOptions: UseMutationOptions<
        CreateBarcodeTemplateResponse2,
        AxiosError<CreateBarcodeTemplateError>,
        Options<CreateBarcodeTemplateData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await createBarcodeTemplate({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Barcode Template
 */
export const deleteBarcodeTemplateMutation = (
    options?: Partial<Options<DeleteBarcodeTemplateData>>
): UseMutationOptions<
    DeleteBarcodeTemplateResponse2,
    AxiosError<DeleteBarcodeTemplateError>,
    Options<DeleteBarcodeTemplateData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteBarcodeTemplateResponse2,
        AxiosError<DeleteBarcodeTemplateError>,
        Options<DeleteBarcodeTemplateData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteBarcodeTemplate({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Update Barcode Template
 */
export const updateBarcodeTemplateMutation = (
    options?: Partial<Options<UpdateBarcodeTemplateData>>
): UseMutationOptions<
    UpdateBarcodeTemplateResponse2,
    AxiosError<UpdateBarcodeTemplateError>,
    Options<UpdateBarcodeTemplateData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateBarcodeTemplateResponse2,
        AxiosError<UpdateBarcodeTemplateError>,
        Options<UpdateBarcodeTemplateData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateBarcodeTemplate({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getBarcodeTemplateAttributesQueryKey = (
    options?: Options<GetBarcodeTemplateAttributesData>
) => createQueryKey("getBarcodeTemplateAttributes", options);

/**
 * Get Barcode Template Attributes
 */
export const getBarcodeTemplateAttributesOptions = (
    options?: Options<GetBarcodeTemplateAttributesData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getBarcodeTemplateAttributes({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getBarcodeTemplateAttributesQueryKey(options),
    });
};

export const getBarcodeTemplateSizesQueryKey = (
    options?: Options<GetBarcodeTemplateSizesData>
) => createQueryKey("getBarcodeTemplateSizes", options);

/**
 * Get Barcode Template Sizes
 */
export const getBarcodeTemplateSizesOptions = (
    options?: Options<GetBarcodeTemplateSizesData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getBarcodeTemplateSizes({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getBarcodeTemplateSizesQueryKey(options),
    });
};

export const getDealProductsQueryKey = (
    options: Options<GetDealProductsData>
) => createQueryKey("getDealProducts", options);

/**
 * Get Deal Products
 */
export const getDealProductsOptions = (
    options: Options<GetDealProductsData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getDealProducts({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getDealProductsQueryKey(options),
    });
};

export const createDealProductQueryKey = (
    options: Options<CreateDealProductData>
) => createQueryKey("createDealProduct", options);

/**
 * Create Deal Product
 */
export const createDealProductOptions = (
    options: Options<CreateDealProductData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await createDealProduct({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: createDealProductQueryKey(options),
    });
};

/**
 * Create Deal Product
 */
export const createDealProductMutation = (
    options?: Partial<Options<CreateDealProductData>>
): UseMutationOptions<
    CreateDealProductResponse2,
    AxiosError<CreateDealProductError>,
    Options<CreateDealProductData>
> => {
    const mutationOptions: UseMutationOptions<
        CreateDealProductResponse2,
        AxiosError<CreateDealProductError>,
        Options<CreateDealProductData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await createDealProduct({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Deal Product
 */
export const deleteDealProductMutation = (
    options?: Partial<Options<DeleteDealProductData>>
): UseMutationOptions<
    DeleteDealProductResponse2,
    AxiosError<DeleteDealProductError>,
    Options<DeleteDealProductData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteDealProductResponse2,
        AxiosError<DeleteDealProductError>,
        Options<DeleteDealProductData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteDealProduct({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Update Deal Product
 */
export const updateDealProductMutation = (
    options?: Partial<Options<UpdateDealProductData>>
): UseMutationOptions<
    UpdateDealProductResponse2,
    AxiosError<UpdateDealProductError>,
    Options<UpdateDealProductData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateDealProductResponse2,
        AxiosError<UpdateDealProductError>,
        Options<UpdateDealProductData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateDealProduct({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const createDealProductServiceQueryKey = (
    options: Options<CreateDealProductServiceData>
) => createQueryKey("createDealProductService", options);

/**
 * Create Deal Product Service
 */
export const createDealProductServiceOptions = (
    options: Options<CreateDealProductServiceData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await createDealProductService({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: createDealProductServiceQueryKey(options),
    });
};

/**
 * Create Deal Product Service
 */
export const createDealProductServiceMutation = (
    options?: Partial<Options<CreateDealProductServiceData>>
): UseMutationOptions<
    CreateDealProductServiceResponse,
    AxiosError<CreateDealProductServiceError>,
    Options<CreateDealProductServiceData>
> => {
    const mutationOptions: UseMutationOptions<
        CreateDealProductServiceResponse,
        AxiosError<CreateDealProductServiceError>,
        Options<CreateDealProductServiceData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await createDealProductService({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Deal Product Service
 */
export const deleteDealProductServiceMutation = (
    options?: Partial<Options<DeleteDealProductServiceData>>
): UseMutationOptions<
    DeleteDealProductServiceResponse,
    AxiosError<DeleteDealProductServiceError>,
    Options<DeleteDealProductServiceData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteDealProductServiceResponse,
        AxiosError<DeleteDealProductServiceError>,
        Options<DeleteDealProductServiceData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteDealProductService({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Update Deal Product Service
 */
export const updateDealProductServiceMutation = (
    options?: Partial<Options<UpdateDealProductServiceData>>
): UseMutationOptions<
    UpdateDealProductServiceResponse,
    AxiosError<UpdateDealProductServiceError>,
    Options<UpdateDealProductServiceData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateDealProductServiceResponse,
        AxiosError<UpdateDealProductServiceError>,
        Options<UpdateDealProductServiceData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateDealProductService({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const duplicateProductServicesQueryKey = (
    options: Options<DuplicateProductServicesData>
) => createQueryKey("duplicateProductServices", options);

/**
 * Copy Product Services
 */
export const duplicateProductServicesOptions = (
    options: Options<DuplicateProductServicesData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await duplicateProductServices({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: duplicateProductServicesQueryKey(options),
    });
};

/**
 * Copy Product Services
 */
export const duplicateProductServicesMutation = (
    options?: Partial<Options<DuplicateProductServicesData>>
): UseMutationOptions<
    DuplicateProductServicesResponse,
    AxiosError<DuplicateProductServicesError>,
    Options<DuplicateProductServicesData>
> => {
    const mutationOptions: UseMutationOptions<
        DuplicateProductServicesResponse,
        AxiosError<DuplicateProductServicesError>,
        Options<DuplicateProductServicesData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await duplicateProductServices({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const addKitToDealProductQueryKey = (
    options: Options<AddKitToDealProductData>
) => createQueryKey("addKitToDealProduct", options);

/**
 * Add Kit To Deal Product
 */
export const addKitToDealProductOptions = (
    options: Options<AddKitToDealProductData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await addKitToDealProduct({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: addKitToDealProductQueryKey(options),
    });
};

/**
 * Add Kit To Deal Product
 */
export const addKitToDealProductMutation = (
    options?: Partial<Options<AddKitToDealProductData>>
): UseMutationOptions<
    AddKitToDealProductResponse,
    AxiosError<AddKitToDealProductError>,
    Options<AddKitToDealProductData>
> => {
    const mutationOptions: UseMutationOptions<
        AddKitToDealProductResponse,
        AxiosError<AddKitToDealProductError>,
        Options<AddKitToDealProductData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await addKitToDealProduct({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getDealServicesQueryKey = (
    options: Options<GetDealServicesData>
) => createQueryKey("getDealServices", options);

/**
 * Get Deal Services
 */
export const getDealServicesOptions = (
    options: Options<GetDealServicesData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getDealServices({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getDealServicesQueryKey(options),
    });
};

export const createDealServiceQueryKey = (
    options: Options<CreateDealServiceData>
) => createQueryKey("createDealService", options);

/**
 * Create Deal Service
 */
export const createDealServiceOptions = (
    options: Options<CreateDealServiceData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await createDealService({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: createDealServiceQueryKey(options),
    });
};

/**
 * Create Deal Service
 */
export const createDealServiceMutation = (
    options?: Partial<Options<CreateDealServiceData>>
): UseMutationOptions<
    CreateDealServiceResponse2,
    AxiosError<CreateDealServiceError>,
    Options<CreateDealServiceData>
> => {
    const mutationOptions: UseMutationOptions<
        CreateDealServiceResponse2,
        AxiosError<CreateDealServiceError>,
        Options<CreateDealServiceData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await createDealService({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Deal Service
 */
export const deleteDealServiceMutation = (
    options?: Partial<Options<DeleteDealServiceData>>
): UseMutationOptions<
    DeleteDealServiceResponse2,
    AxiosError<DeleteDealServiceError>,
    Options<DeleteDealServiceData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteDealServiceResponse2,
        AxiosError<DeleteDealServiceError>,
        Options<DeleteDealServiceData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteDealService({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Update Deal Service
 */
export const updateDealServiceMutation = (
    options?: Partial<Options<UpdateDealServiceData>>
): UseMutationOptions<
    UpdateDealServiceResponse2,
    AxiosError<UpdateDealServiceError>,
    Options<UpdateDealServiceData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateDealServiceResponse2,
        AxiosError<UpdateDealServiceError>,
        Options<UpdateDealServiceData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateDealService({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const addKitToDealQueryKey = (options: Options<AddKitToDealData>) =>
    createQueryKey("addKitToDeal", options);

/**
 * Add Kit To Deal
 */
export const addKitToDealOptions = (options: Options<AddKitToDealData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await addKitToDeal({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: addKitToDealQueryKey(options),
    });
};

/**
 * Add Kit To Deal
 */
export const addKitToDealMutation = (
    options?: Partial<Options<AddKitToDealData>>
): UseMutationOptions<
    AddKitToDealResponse,
    AxiosError<AddKitToDealError>,
    Options<AddKitToDealData>
> => {
    const mutationOptions: UseMutationOptions<
        AddKitToDealResponse,
        AxiosError<AddKitToDealError>,
        Options<AddKitToDealData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await addKitToDeal({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getBaseMarketplacesQueryKey = (
    options?: Options<GetBaseMarketplacesData>
) => createQueryKey("getBaseMarketplaces", options);

/**
 * Get Base Marketplaces
 */
export const getBaseMarketplacesOptions = (
    options?: Options<GetBaseMarketplacesData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getBaseMarketplaces({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getBaseMarketplacesQueryKey(options),
    });
};

export const getMarketplacesQueryKey = (
    options: Options<GetMarketplacesData>
) => createQueryKey("getMarketplaces", options);

/**
 * Get Marketplaces
 */
export const getMarketplacesOptions = (
    options: Options<GetMarketplacesData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getMarketplaces({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getMarketplacesQueryKey(options),
    });
};

export const createMarketplaceQueryKey = (
    options: Options<CreateMarketplaceData>
) => createQueryKey("createMarketplace", options);

/**
 * Create Product
 */
export const createMarketplaceOptions = (
    options: Options<CreateMarketplaceData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await createMarketplace({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: createMarketplaceQueryKey(options),
    });
};

/**
 * Create Product
 */
export const createMarketplaceMutation = (
    options?: Partial<Options<CreateMarketplaceData>>
): UseMutationOptions<
    CreateMarketplaceResponse2,
    AxiosError<CreateMarketplaceError>,
    Options<CreateMarketplaceData>
> => {
    const mutationOptions: UseMutationOptions<
        CreateMarketplaceResponse2,
        AxiosError<CreateMarketplaceError>,
        Options<CreateMarketplaceData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await createMarketplace({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Marketplace
 */
export const deleteMarketplaceMutation = (
    options?: Partial<Options<DeleteMarketplaceData>>
): UseMutationOptions<
    DeleteMarketplaceResponse2,
    AxiosError<DeleteMarketplaceError>,
    Options<DeleteMarketplaceData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteMarketplaceResponse2,
        AxiosError<DeleteMarketplaceError>,
        Options<DeleteMarketplaceData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteMarketplace({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Update Marketplace
 */
export const updateMarketplaceMutation = (
    options?: Partial<Options<UpdateMarketplaceData>>
): UseMutationOptions<
    UpdateMarketplaceResponse2,
    AxiosError<UpdateMarketplaceError>,
    Options<UpdateMarketplaceData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateMarketplaceResponse2,
        AxiosError<UpdateMarketplaceError>,
        Options<UpdateMarketplaceData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateMarketplace({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getProductsQueryKey = (options?: Options<GetProductsData>) =>
    createQueryKey("getProducts", options);

/**
 * Get Products
 */
export const getProductsOptions = (options?: Options<GetProductsData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getProducts({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getProductsQueryKey(options),
    });
};

export const getProductsInfiniteQueryKey = (
    options?: Options<GetProductsData>
): QueryKey<Options<GetProductsData>> =>
    createQueryKey("getProducts", options, true);

/**
 * Get Products
 */
export const getProductsInfiniteOptions = (
    options?: Options<GetProductsData>
) => {
    return infiniteQueryOptions<
        GetProductsResponse2,
        AxiosError<GetProductsError>,
        InfiniteData<GetProductsResponse2>,
        QueryKey<Options<GetProductsData>>,
        | number
        | null
        | Pick<
              QueryKey<Options<GetProductsData>>[0],
              "body" | "headers" | "path" | "query"
          >
    >(
        // @ts-ignore
        {
            queryFn: async ({ pageParam, queryKey, signal }) => {
                // @ts-ignore
                const page: Pick<
                    QueryKey<Options<GetProductsData>>[0],
                    "body" | "headers" | "path" | "query"
                > =
                    typeof pageParam === "object"
                        ? pageParam
                        : {
                              query: {
                                  page: pageParam,
                              },
                          };
                const params = createInfiniteParams(queryKey, page);
                const { data } = await getProducts({
                    ...options,
                    ...params,
                    signal,
                    throwOnError: true,
                });
                return data;
            },
            queryKey: getProductsInfiniteQueryKey(options),
        }
    );
};

export const createProductQueryKey = (options: Options<CreateProductData>) =>
    createQueryKey("createProduct", options);

/**
 * Create Product
 */
export const createProductOptions = (options: Options<CreateProductData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await createProduct({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: createProductQueryKey(options),
    });
};

/**
 * Create Product
 */
export const createProductMutation = (
    options?: Partial<Options<CreateProductData>>
): UseMutationOptions<
    CreateProductResponse2,
    AxiosError<CreateProductError>,
    Options<CreateProductData>
> => {
    const mutationOptions: UseMutationOptions<
        CreateProductResponse2,
        AxiosError<CreateProductError>,
        Options<CreateProductData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await createProduct({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Product
 */
export const deleteProductMutation = (
    options?: Partial<Options<DeleteProductData>>
): UseMutationOptions<
    DeleteProductResponse2,
    AxiosError<DeleteProductError>,
    Options<DeleteProductData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteProductResponse2,
        AxiosError<DeleteProductError>,
        Options<DeleteProductData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteProduct({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Update Product
 */
export const updateProductMutation = (
    options?: Partial<Options<UpdateProductData>>
): UseMutationOptions<
    UpdateProductResponse2,
    AxiosError<UpdateProductError>,
    Options<UpdateProductData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateProductResponse2,
        AxiosError<UpdateProductError>,
        Options<UpdateProductData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateProduct({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const uploadProductImageQueryKey = (
    options: Options<UploadProductImageData>
) => createQueryKey("uploadProductImage", options);

/**
 * Upload Product Image
 */
export const uploadProductImageOptions = (
    options: Options<UploadProductImageData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await uploadProductImage({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: uploadProductImageQueryKey(options),
    });
};

/**
 * Upload Product Image
 */
export const uploadProductImageMutation = (
    options?: Partial<Options<UploadProductImageData>>
): UseMutationOptions<
    UploadProductImageResponse,
    AxiosError<UploadProductImageError>,
    Options<UploadProductImageData>
> => {
    const mutationOptions: UseMutationOptions<
        UploadProductImageResponse,
        AxiosError<UploadProductImageError>,
        Options<UploadProductImageData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await uploadProductImage({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getProductBarcodePdfQueryKey = (
    options: Options<GetProductBarcodePdfData>
) => createQueryKey("getProductBarcodePdf", options);

/**
 * Get Product Barcode Pdf
 */
export const getProductBarcodePdfOptions = (
    options: Options<GetProductBarcodePdfData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getProductBarcodePdf({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getProductBarcodePdfQueryKey(options),
    });
};

/**
 * Get Product Barcode Pdf
 */
export const getProductBarcodePdfMutation = (
    options?: Partial<Options<GetProductBarcodePdfData>>
): UseMutationOptions<
    GetProductBarcodePdfResponse2,
    AxiosError<GetProductBarcodePdfError>,
    Options<GetProductBarcodePdfData>
> => {
    const mutationOptions: UseMutationOptions<
        GetProductBarcodePdfResponse2,
        AxiosError<GetProductBarcodePdfError>,
        Options<GetProductBarcodePdfData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await getProductBarcodePdf({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getDealBarcodesPdfQueryKey = (
    options: Options<GetDealBarcodesPdfData>
) => createQueryKey("getDealBarcodesPdf", options);

/**
 * Get Deal Barcodes Pdf
 */
export const getDealBarcodesPdfOptions = (
    options: Options<GetDealBarcodesPdfData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getDealBarcodesPdf({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getDealBarcodesPdfQueryKey(options),
    });
};

/**
 * Get Deal Barcodes Pdf
 */
export const getDealBarcodesPdfMutation = (
    options?: Partial<Options<GetDealBarcodesPdfData>>
): UseMutationOptions<
    GetDealBarcodesPdfResponse2,
    AxiosError<GetDealBarcodesPdfError>,
    Options<GetDealBarcodesPdfData>
> => {
    const mutationOptions: UseMutationOptions<
        GetDealBarcodesPdfResponse2,
        AxiosError<GetDealBarcodesPdfError>,
        Options<GetDealBarcodesPdfData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await getDealBarcodesPdf({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const uploadProductBarcodeImageQueryKey = (
    options: Options<UploadProductBarcodeImageData>
) => createQueryKey("uploadProductBarcodeImage", options);

/**
 * Upload Product Barcode Image
 */
export const uploadProductBarcodeImageOptions = (
    options: Options<UploadProductBarcodeImageData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await uploadProductBarcodeImage({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: uploadProductBarcodeImageQueryKey(options),
    });
};

/**
 * Upload Product Barcode Image
 */
export const uploadProductBarcodeImageMutation = (
    options?: Partial<Options<UploadProductBarcodeImageData>>
): UseMutationOptions<
    UploadProductBarcodeImageResponse,
    AxiosError<UploadProductBarcodeImageError>,
    Options<UploadProductBarcodeImageData>
> => {
    const mutationOptions: UseMutationOptions<
        UploadProductBarcodeImageResponse,
        AxiosError<UploadProductBarcodeImageError>,
        Options<UploadProductBarcodeImageData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await uploadProductBarcodeImage({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Product Barcode Image
 */
export const deleteProductBarcodeImageMutation = (
    options?: Partial<Options<DeleteProductBarcodeImageData>>
): UseMutationOptions<
    DeleteProductBarcodeImageResponse,
    AxiosError<DeleteProductBarcodeImageError>,
    Options<DeleteProductBarcodeImageData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteProductBarcodeImageResponse,
        AxiosError<DeleteProductBarcodeImageError>,
        Options<DeleteProductBarcodeImageData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteProductBarcodeImage({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getServicesQueryKey = (options?: Options<GetServicesData>) =>
    createQueryKey("getServices", options);

/**
 * Get Services
 */
export const getServicesOptions = (options?: Options<GetServicesData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getServices({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getServicesQueryKey(options),
    });
};

export const createServiceQueryKey = (options: Options<CreateServiceData>) =>
    createQueryKey("createService", options);

/**
 * Create Service
 */
export const createServiceOptions = (options: Options<CreateServiceData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await createService({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: createServiceQueryKey(options),
    });
};

/**
 * Create Service
 */
export const createServiceMutation = (
    options?: Partial<Options<CreateServiceData>>
): UseMutationOptions<
    CreateServiceResponse2,
    AxiosError<CreateServiceError>,
    Options<CreateServiceData>
> => {
    const mutationOptions: UseMutationOptions<
        CreateServiceResponse2,
        AxiosError<CreateServiceError>,
        Options<CreateServiceData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await createService({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Service
 */
export const deleteServiceMutation = (
    options?: Partial<Options<DeleteServiceData>>
): UseMutationOptions<
    DeleteServiceResponse2,
    AxiosError<DeleteServiceError>,
    Options<DeleteServiceData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteServiceResponse2,
        AxiosError<DeleteServiceError>,
        Options<DeleteServiceData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteService({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Update Service
 */
export const updateServiceMutation = (
    options?: Partial<Options<UpdateServiceData>>
): UseMutationOptions<
    UpdateServiceResponse2,
    AxiosError<UpdateServiceError>,
    Options<UpdateServiceData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateServiceResponse2,
        AxiosError<UpdateServiceError>,
        Options<UpdateServiceData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateService({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getServiceCategoriesQueryKey = (
    options?: Options<GetServiceCategoriesData>
) => createQueryKey("getServiceCategories", options);

/**
 * Get Services Categories
 */
export const getServiceCategoriesOptions = (
    options?: Options<GetServiceCategoriesData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getServiceCategories({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getServiceCategoriesQueryKey(options),
    });
};

export const createServiceCategoryQueryKey = (
    options: Options<CreateServiceCategoryData>
) => createQueryKey("createServiceCategory", options);

/**
 * Create Service Category
 */
export const createServiceCategoryOptions = (
    options: Options<CreateServiceCategoryData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await createServiceCategory({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: createServiceCategoryQueryKey(options),
    });
};

/**
 * Create Service Category
 */
export const createServiceCategoryMutation = (
    options?: Partial<Options<CreateServiceCategoryData>>
): UseMutationOptions<
    CreateServiceCategoryResponse2,
    AxiosError<CreateServiceCategoryError>,
    Options<CreateServiceCategoryData>
> => {
    const mutationOptions: UseMutationOptions<
        CreateServiceCategoryResponse2,
        AxiosError<CreateServiceCategoryError>,
        Options<CreateServiceCategoryData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await createServiceCategory({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Service Category
 */
export const deleteServiceCategoryMutation = (
    options?: Partial<Options<DeleteServiceCategoryData>>
): UseMutationOptions<
    DeleteServiceCategoryResponse2,
    AxiosError<DeleteServiceCategoryError>,
    Options<DeleteServiceCategoryData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteServiceCategoryResponse2,
        AxiosError<DeleteServiceCategoryError>,
        Options<DeleteServiceCategoryData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteServiceCategory({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Update Service Category
 */
export const updateServiceCategoryMutation = (
    options?: Partial<Options<UpdateServiceCategoryData>>
): UseMutationOptions<
    UpdateServiceCategoryResponse2,
    AxiosError<UpdateServiceCategoryError>,
    Options<UpdateServiceCategoryData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateServiceCategoryResponse2,
        AxiosError<UpdateServiceCategoryError>,
        Options<UpdateServiceCategoryData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateServiceCategory({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getServicesKitsQueryKey = (
    options?: Options<GetServicesKitsData>
) => createQueryKey("getServicesKits", options);

/**
 * Get Services Kits
 */
export const getServicesKitsOptions = (
    options?: Options<GetServicesKitsData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getServicesKits({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getServicesKitsQueryKey(options),
    });
};

export const createServicesKitQueryKey = (
    options: Options<CreateServicesKitData>
) => createQueryKey("createServicesKit", options);

/**
 * Create Services Kit
 */
export const createServicesKitOptions = (
    options: Options<CreateServicesKitData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await createServicesKit({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: createServicesKitQueryKey(options),
    });
};

/**
 * Create Services Kit
 */
export const createServicesKitMutation = (
    options?: Partial<Options<CreateServicesKitData>>
): UseMutationOptions<
    CreateServicesKitResponse2,
    AxiosError<CreateServicesKitError>,
    Options<CreateServicesKitData>
> => {
    const mutationOptions: UseMutationOptions<
        CreateServicesKitResponse2,
        AxiosError<CreateServicesKitError>,
        Options<CreateServicesKitData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await createServicesKit({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Services Kit
 */
export const deleteServicesKitMutation = (
    options?: Partial<Options<DeleteServicesKitData>>
): UseMutationOptions<
    DeleteServicesKitResponse2,
    AxiosError<DeleteServicesKitError>,
    Options<DeleteServicesKitData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteServicesKitResponse2,
        AxiosError<DeleteServicesKitError>,
        Options<DeleteServicesKitData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteServicesKit({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Update Services Kit
 */
export const updateServicesKitMutation = (
    options?: Partial<Options<UpdateServicesKitData>>
): UseMutationOptions<
    UpdateServicesKitResponse2,
    AxiosError<UpdateServicesKitError>,
    Options<UpdateServicesKitData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateServicesKitResponse2,
        AxiosError<UpdateServicesKitError>,
        Options<UpdateServicesKitData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateServicesKit({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getProjectsQueryKey = (options?: Options<GetProjectsData>) =>
    createQueryKey("getProjects", options);

/**
 * Get Projects
 */
export const getProjectsOptions = (options?: Options<GetProjectsData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getProjects({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getProjectsQueryKey(options),
    });
};

export const createProjectQueryKey = (options: Options<CreateProjectData>) =>
    createQueryKey("createProject", options);

/**
 * Create Project
 */
export const createProjectOptions = (options: Options<CreateProjectData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await createProject({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: createProjectQueryKey(options),
    });
};

/**
 * Create Project
 */
export const createProjectMutation = (
    options?: Partial<Options<CreateProjectData>>
): UseMutationOptions<
    CreateProjectResponse2,
    AxiosError<CreateProjectError>,
    Options<CreateProjectData>
> => {
    const mutationOptions: UseMutationOptions<
        CreateProjectResponse2,
        AxiosError<CreateProjectError>,
        Options<CreateProjectData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await createProject({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Project
 */
export const deleteProjectMutation = (
    options?: Partial<Options<DeleteProjectData>>
): UseMutationOptions<
    DeleteProjectResponse2,
    AxiosError<DeleteProjectError>,
    Options<DeleteProjectData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteProjectResponse2,
        AxiosError<DeleteProjectError>,
        Options<DeleteProjectData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteProject({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Update Project
 */
export const updateProjectMutation = (
    options?: Partial<Options<UpdateProjectData>>
): UseMutationOptions<
    UpdateProjectResponse2,
    AxiosError<UpdateProjectError>,
    Options<UpdateProjectData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateProjectResponse2,
        AxiosError<UpdateProjectError>,
        Options<UpdateProjectData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateProject({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getStatusesQueryKey = (options: Options<GetStatusesData>) =>
    createQueryKey("getStatuses", options);

/**
 * Get Statuses
 */
export const getStatusesOptions = (options: Options<GetStatusesData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getStatuses({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getStatusesQueryKey(options),
    });
};

export const createStatusQueryKey = (options: Options<CreateStatusData>) =>
    createQueryKey("createStatus", options);

/**
 * Create Status
 */
export const createStatusOptions = (options: Options<CreateStatusData>) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await createStatus({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: createStatusQueryKey(options),
    });
};

/**
 * Create Status
 */
export const createStatusMutation = (
    options?: Partial<Options<CreateStatusData>>
): UseMutationOptions<
    CreateStatusResponse2,
    AxiosError<CreateStatusError>,
    Options<CreateStatusData>
> => {
    const mutationOptions: UseMutationOptions<
        CreateStatusResponse2,
        AxiosError<CreateStatusError>,
        Options<CreateStatusData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await createStatus({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Delete Status
 */
export const deleteStatusMutation = (
    options?: Partial<Options<DeleteStatusData>>
): UseMutationOptions<
    DeleteStatusResponse2,
    AxiosError<DeleteStatusError>,
    Options<DeleteStatusData>
> => {
    const mutationOptions: UseMutationOptions<
        DeleteStatusResponse2,
        AxiosError<DeleteStatusError>,
        Options<DeleteStatusData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await deleteStatus({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

/**
 * Update Status
 */
export const updateStatusMutation = (
    options?: Partial<Options<UpdateStatusData>>
): UseMutationOptions<
    UpdateStatusResponse2,
    AxiosError<UpdateStatusError>,
    Options<UpdateStatusData>
> => {
    const mutationOptions: UseMutationOptions<
        UpdateStatusResponse2,
        AxiosError<UpdateStatusError>,
        Options<UpdateStatusData>
    > = {
        mutationFn: async localOptions => {
            const { data } = await updateStatus({
                ...options,
                ...localOptions,
                throwOnError: true,
            });
            return data;
        },
    };
    return mutationOptions;
};

export const getStatusHistoryQueryKey = (
    options: Options<GetStatusHistoryData>
) => createQueryKey("getStatusHistory", options);

/**
 * Get Status History
 */
export const getStatusHistoryOptions = (
    options: Options<GetStatusHistoryData>
) => {
    return queryOptions({
        queryFn: async ({ queryKey, signal }) => {
            const { data } = await getStatusHistory({
                ...options,
                ...queryKey[0],
                signal,
                throwOnError: true,
            });
            return data;
        },
        queryKey: getStatusHistoryQueryKey(options),
    });
};
