/**
 * Generated by orval v8.8.0 🍺
 * Do not edit manually.
 * OpenAPI spec version: 0.0.0
 */
import { useMutation, useQuery } from "@tanstack/react-query";
import type {
  DataTag,
  DefinedInitialDataOptions,
  DefinedUseQueryResult,
  MutationFunction,
  QueryClient,
  QueryFunction,
  QueryKey,
  UndefinedInitialDataOptions,
  UseMutationOptions,
  UseMutationResult,
  UseQueryOptions,
  UseQueryResult,
} from "@tanstack/react-query";

import type {
  ApiConfigurationShopConfigurationListParams,
  ApiConfigurationVatRatesListParams,
  PaginatedSiteConfigurationList,
  PaginatedVATRateList,
  PatchedSiteConfiguration,
  PatchedVATRate,
  SiteConfiguration,
  VATRate,
} from "../models";

import { privateMutator } from "../../../privateClient";

// https://stackoverflow.com/questions/49579094/typescript-conditional-types-filter-out-readonly-properties-pick-only-requir/49579497#49579497
type IfEquals<X, Y, A = X, B = never> =
  (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? A : B;

type WritableKeys<T> = {
  [P in keyof T]-?: IfEquals<
    { [Q in P]: T[P] },
    { -readonly [Q in P]: T[P] },
    P
  >;
}[keyof T];

type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (
  k: infer I,
) => void
  ? I
  : never;
type DistributeReadOnlyOverUnions<T> = T extends any ? NonReadonly<T> : never;

type Writable<T> = Pick<T, WritableKeys<T>>;
type NonReadonly<T> = [T] extends [UnionToIntersection<T>]
  ? {
      [P in keyof Writable<T>]: T[P] extends object
        ? NonReadonly<NonNullable<T[P]>>
        : T[P];
    }
  : DistributeReadOnlyOverUnions<T>;

/**
 * Returns the current site currency and available options
 * @summary Get site currency information
 */
export const apiCommerceCurrencyInfoRetrieve = (signal?: AbortSignal) => {
  return privateMutator<void>({
    url: `/api/commerce/currency/info/`,
    method: "GET",
    signal,
  });
};

export const getApiCommerceCurrencyInfoRetrieveQueryKey = () => {
  return [`/api/commerce/currency/info/`] as const;
};

export const getApiCommerceCurrencyInfoRetrieveQueryOptions = <
  TData = Awaited<ReturnType<typeof apiCommerceCurrencyInfoRetrieve>>,
  TError = unknown,
>(options?: {
  query?: Partial<
    UseQueryOptions<
      Awaited<ReturnType<typeof apiCommerceCurrencyInfoRetrieve>>,
      TError,
      TData
    >
  >;
}) => {
  const { query: queryOptions } = options ?? {};

  const queryKey =
    queryOptions?.queryKey ?? getApiCommerceCurrencyInfoRetrieveQueryKey();

  const queryFn: QueryFunction<
    Awaited<ReturnType<typeof apiCommerceCurrencyInfoRetrieve>>
  > = ({ signal }) => apiCommerceCurrencyInfoRetrieve(signal);

  return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
    Awaited<ReturnType<typeof apiCommerceCurrencyInfoRetrieve>>,
    TError,
    TData
  > & { queryKey: DataTag<QueryKey, TData, TError> };
};

export type ApiCommerceCurrencyInfoRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceCurrencyInfoRetrieve>>
>;
export type ApiCommerceCurrencyInfoRetrieveQueryError = unknown;

export function useApiCommerceCurrencyInfoRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceCurrencyInfoRetrieve>>,
  TError = unknown,
>(
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceCurrencyInfoRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceCurrencyInfoRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceCurrencyInfoRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceCurrencyInfoRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceCurrencyInfoRetrieve>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceCurrencyInfoRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceCurrencyInfoRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceCurrencyInfoRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceCurrencyInfoRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceCurrencyInfoRetrieve>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceCurrencyInfoRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary Get site currency information
 */

export function useApiCommerceCurrencyInfoRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceCurrencyInfoRetrieve>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceCurrencyInfoRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions = getApiCommerceCurrencyInfoRetrieveQueryOptions(options);

  const query = useQuery(queryOptions, queryClient) as UseQueryResult<
    TData,
    TError
  > & { queryKey: DataTag<QueryKey, TData, TError> };

  return { ...query, queryKey: queryOptions.queryKey };
}

/**
 * @summary List site configuration
 */
export const apiConfigurationShopConfigurationList = (
  params?: ApiConfigurationShopConfigurationListParams,
  signal?: AbortSignal,
) => {
  return privateMutator<PaginatedSiteConfigurationList>({
    url: `/api/configuration/shop-configuration/`,
    method: "GET",
    params,
    signal,
  });
};

export const getApiConfigurationShopConfigurationListQueryKey = (
  params?: ApiConfigurationShopConfigurationListParams,
) => {
  return [
    `/api/configuration/shop-configuration/`,
    ...(params ? [params] : []),
  ] as const;
};

export const getApiConfigurationShopConfigurationListQueryOptions = <
  TData = Awaited<ReturnType<typeof apiConfigurationShopConfigurationList>>,
  TError = unknown,
>(
  params?: ApiConfigurationShopConfigurationListParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationShopConfigurationList>>,
        TError,
        TData
      >
    >;
  },
) => {
  const { query: queryOptions } = options ?? {};

  const queryKey =
    queryOptions?.queryKey ??
    getApiConfigurationShopConfigurationListQueryKey(params);

  const queryFn: QueryFunction<
    Awaited<ReturnType<typeof apiConfigurationShopConfigurationList>>
  > = ({ signal }) => apiConfigurationShopConfigurationList(params, signal);

  return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
    Awaited<ReturnType<typeof apiConfigurationShopConfigurationList>>,
    TError,
    TData
  > & { queryKey: DataTag<QueryKey, TData, TError> };
};

export type ApiConfigurationShopConfigurationListQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiConfigurationShopConfigurationList>>
>;
export type ApiConfigurationShopConfigurationListQueryError = unknown;

export function useApiConfigurationShopConfigurationList<
  TData = Awaited<ReturnType<typeof apiConfigurationShopConfigurationList>>,
  TError = unknown,
>(
  params: undefined | ApiConfigurationShopConfigurationListParams,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationShopConfigurationList>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiConfigurationShopConfigurationList>>,
          TError,
          Awaited<ReturnType<typeof apiConfigurationShopConfigurationList>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiConfigurationShopConfigurationList<
  TData = Awaited<ReturnType<typeof apiConfigurationShopConfigurationList>>,
  TError = unknown,
>(
  params?: ApiConfigurationShopConfigurationListParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationShopConfigurationList>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiConfigurationShopConfigurationList>>,
          TError,
          Awaited<ReturnType<typeof apiConfigurationShopConfigurationList>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiConfigurationShopConfigurationList<
  TData = Awaited<ReturnType<typeof apiConfigurationShopConfigurationList>>,
  TError = unknown,
>(
  params?: ApiConfigurationShopConfigurationListParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationShopConfigurationList>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary List site configuration
 */

export function useApiConfigurationShopConfigurationList<
  TData = Awaited<ReturnType<typeof apiConfigurationShopConfigurationList>>,
  TError = unknown,
>(
  params?: ApiConfigurationShopConfigurationListParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationShopConfigurationList>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions = getApiConfigurationShopConfigurationListQueryOptions(
    params,
    options,
  );

  const query = useQuery(queryOptions, queryClient) as UseQueryResult<
    TData,
    TError
  > & { queryKey: DataTag<QueryKey, TData, TError> };

  return { ...query, queryKey: queryOptions.queryKey };
}

/**
 * @summary Create site configuration (admin only)
 */
export const apiConfigurationShopConfigurationCreate = (
  siteConfiguration: NonReadonly<SiteConfiguration>,
  signal?: AbortSignal,
) => {
  return privateMutator<SiteConfiguration>({
    url: `/api/configuration/shop-configuration/`,
    method: "POST",
    headers: { "Content-Type": "application/json" },
    data: siteConfiguration,
    signal,
  });
};

export const getApiConfigurationShopConfigurationCreateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiConfigurationShopConfigurationCreate>>,
    TError,
    { data: NonReadonly<SiteConfiguration> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiConfigurationShopConfigurationCreate>>,
  TError,
  { data: NonReadonly<SiteConfiguration> },
  TContext
> => {
  const mutationKey = ["apiConfigurationShopConfigurationCreate"];
  const { mutation: mutationOptions } = options
    ? options.mutation &&
      "mutationKey" in options.mutation &&
      options.mutation.mutationKey
      ? options
      : { ...options, mutation: { ...options.mutation, mutationKey } }
    : { mutation: { mutationKey } };

  const mutationFn: MutationFunction<
    Awaited<ReturnType<typeof apiConfigurationShopConfigurationCreate>>,
    { data: NonReadonly<SiteConfiguration> }
  > = (props) => {
    const { data } = props ?? {};

    return apiConfigurationShopConfigurationCreate(data);
  };

  return { mutationFn, ...mutationOptions };
};

export type ApiConfigurationShopConfigurationCreateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiConfigurationShopConfigurationCreate>>
>;
export type ApiConfigurationShopConfigurationCreateMutationBody =
  NonReadonly<SiteConfiguration>;
export type ApiConfigurationShopConfigurationCreateMutationError = unknown;

/**
 * @summary Create site configuration (admin only)
 */
export const useApiConfigurationShopConfigurationCreate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiConfigurationShopConfigurationCreate>>,
      TError,
      { data: NonReadonly<SiteConfiguration> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiConfigurationShopConfigurationCreate>>,
  TError,
  { data: NonReadonly<SiteConfiguration> },
  TContext
> => {
  return useMutation(
    getApiConfigurationShopConfigurationCreateMutationOptions(options),
    queryClient,
  );
};
/**
 * @summary Retrieve site configuration
 */
export const apiConfigurationShopConfigurationRetrieve = (
  id: number,
  signal?: AbortSignal,
) => {
  return privateMutator<SiteConfiguration>({
    url: `/api/configuration/shop-configuration/${id}/`,
    method: "GET",
    signal,
  });
};

export const getApiConfigurationShopConfigurationRetrieveQueryKey = (
  id: number,
) => {
  return [`/api/configuration/shop-configuration/${id}/`] as const;
};

export const getApiConfigurationShopConfigurationRetrieveQueryOptions = <
  TData = Awaited<ReturnType<typeof apiConfigurationShopConfigurationRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationShopConfigurationRetrieve>>,
        TError,
        TData
      >
    >;
  },
) => {
  const { query: queryOptions } = options ?? {};

  const queryKey =
    queryOptions?.queryKey ??
    getApiConfigurationShopConfigurationRetrieveQueryKey(id);

  const queryFn: QueryFunction<
    Awaited<ReturnType<typeof apiConfigurationShopConfigurationRetrieve>>
  > = ({ signal }) => apiConfigurationShopConfigurationRetrieve(id, signal);

  return {
    queryKey,
    queryFn,
    enabled: !!id,
    ...queryOptions,
  } as UseQueryOptions<
    Awaited<ReturnType<typeof apiConfigurationShopConfigurationRetrieve>>,
    TError,
    TData
  > & { queryKey: DataTag<QueryKey, TData, TError> };
};

export type ApiConfigurationShopConfigurationRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiConfigurationShopConfigurationRetrieve>>
>;
export type ApiConfigurationShopConfigurationRetrieveQueryError = unknown;

export function useApiConfigurationShopConfigurationRetrieve<
  TData = Awaited<ReturnType<typeof apiConfigurationShopConfigurationRetrieve>>,
  TError = unknown,
>(
  id: number,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationShopConfigurationRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiConfigurationShopConfigurationRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiConfigurationShopConfigurationRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiConfigurationShopConfigurationRetrieve<
  TData = Awaited<ReturnType<typeof apiConfigurationShopConfigurationRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationShopConfigurationRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiConfigurationShopConfigurationRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiConfigurationShopConfigurationRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiConfigurationShopConfigurationRetrieve<
  TData = Awaited<ReturnType<typeof apiConfigurationShopConfigurationRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationShopConfigurationRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary Retrieve site configuration
 */

export function useApiConfigurationShopConfigurationRetrieve<
  TData = Awaited<ReturnType<typeof apiConfigurationShopConfigurationRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationShopConfigurationRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions = getApiConfigurationShopConfigurationRetrieveQueryOptions(
    id,
    options,
  );

  const query = useQuery(queryOptions, queryClient) as UseQueryResult<
    TData,
    TError
  > & { queryKey: DataTag<QueryKey, TData, TError> };

  return { ...query, queryKey: queryOptions.queryKey };
}

/**
 * @summary Replace site configuration (admin only)
 */
export const apiConfigurationShopConfigurationUpdate = (
  id: number,
  siteConfiguration: NonReadonly<SiteConfiguration>,
  signal?: AbortSignal,
) => {
  return privateMutator<SiteConfiguration>({
    url: `/api/configuration/shop-configuration/${id}/`,
    method: "PUT",
    headers: { "Content-Type": "application/json" },
    data: siteConfiguration,
    signal,
  });
};

export const getApiConfigurationShopConfigurationUpdateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiConfigurationShopConfigurationUpdate>>,
    TError,
    { id: number; data: NonReadonly<SiteConfiguration> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiConfigurationShopConfigurationUpdate>>,
  TError,
  { id: number; data: NonReadonly<SiteConfiguration> },
  TContext
> => {
  const mutationKey = ["apiConfigurationShopConfigurationUpdate"];
  const { mutation: mutationOptions } = options
    ? options.mutation &&
      "mutationKey" in options.mutation &&
      options.mutation.mutationKey
      ? options
      : { ...options, mutation: { ...options.mutation, mutationKey } }
    : { mutation: { mutationKey } };

  const mutationFn: MutationFunction<
    Awaited<ReturnType<typeof apiConfigurationShopConfigurationUpdate>>,
    { id: number; data: NonReadonly<SiteConfiguration> }
  > = (props) => {
    const { id, data } = props ?? {};

    return apiConfigurationShopConfigurationUpdate(id, data);
  };

  return { mutationFn, ...mutationOptions };
};

export type ApiConfigurationShopConfigurationUpdateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiConfigurationShopConfigurationUpdate>>
>;
export type ApiConfigurationShopConfigurationUpdateMutationBody =
  NonReadonly<SiteConfiguration>;
export type ApiConfigurationShopConfigurationUpdateMutationError = unknown;

/**
 * @summary Replace site configuration (admin only)
 */
export const useApiConfigurationShopConfigurationUpdate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiConfigurationShopConfigurationUpdate>>,
      TError,
      { id: number; data: NonReadonly<SiteConfiguration> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiConfigurationShopConfigurationUpdate>>,
  TError,
  { id: number; data: NonReadonly<SiteConfiguration> },
  TContext
> => {
  return useMutation(
    getApiConfigurationShopConfigurationUpdateMutationOptions(options),
    queryClient,
  );
};
/**
 * @summary Update site configuration (admin only)
 */
export const apiConfigurationShopConfigurationPartialUpdate = (
  id: number,
  patchedSiteConfiguration: NonReadonly<PatchedSiteConfiguration>,
  signal?: AbortSignal,
) => {
  return privateMutator<SiteConfiguration>({
    url: `/api/configuration/shop-configuration/${id}/`,
    method: "PATCH",
    headers: { "Content-Type": "application/json" },
    data: patchedSiteConfiguration,
    signal,
  });
};

export const getApiConfigurationShopConfigurationPartialUpdateMutationOptions =
  <TError = unknown, TContext = unknown>(options?: {
    mutation?: UseMutationOptions<
      Awaited<
        ReturnType<typeof apiConfigurationShopConfigurationPartialUpdate>
      >,
      TError,
      { id: number; data: NonReadonly<PatchedSiteConfiguration> },
      TContext
    >;
  }): UseMutationOptions<
    Awaited<ReturnType<typeof apiConfigurationShopConfigurationPartialUpdate>>,
    TError,
    { id: number; data: NonReadonly<PatchedSiteConfiguration> },
    TContext
  > => {
    const mutationKey = ["apiConfigurationShopConfigurationPartialUpdate"];
    const { mutation: mutationOptions } = options
      ? options.mutation &&
        "mutationKey" in options.mutation &&
        options.mutation.mutationKey
        ? options
        : { ...options, mutation: { ...options.mutation, mutationKey } }
      : { mutation: { mutationKey } };

    const mutationFn: MutationFunction<
      Awaited<
        ReturnType<typeof apiConfigurationShopConfigurationPartialUpdate>
      >,
      { id: number; data: NonReadonly<PatchedSiteConfiguration> }
    > = (props) => {
      const { id, data } = props ?? {};

      return apiConfigurationShopConfigurationPartialUpdate(id, data);
    };

    return { mutationFn, ...mutationOptions };
  };

export type ApiConfigurationShopConfigurationPartialUpdateMutationResult =
  NonNullable<
    Awaited<ReturnType<typeof apiConfigurationShopConfigurationPartialUpdate>>
  >;
export type ApiConfigurationShopConfigurationPartialUpdateMutationBody =
  NonReadonly<PatchedSiteConfiguration>;
export type ApiConfigurationShopConfigurationPartialUpdateMutationError =
  unknown;

/**
 * @summary Update site configuration (admin only)
 */
export const useApiConfigurationShopConfigurationPartialUpdate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<
        ReturnType<typeof apiConfigurationShopConfigurationPartialUpdate>
      >,
      TError,
      { id: number; data: NonReadonly<PatchedSiteConfiguration> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiConfigurationShopConfigurationPartialUpdate>>,
  TError,
  { id: number; data: NonReadonly<PatchedSiteConfiguration> },
  TContext
> => {
  return useMutation(
    getApiConfigurationShopConfigurationPartialUpdateMutationOptions(options),
    queryClient,
  );
};
/**
 * @summary Delete site configuration (admin only)
 */
export const apiConfigurationShopConfigurationDestroy = (
  id: number,
  signal?: AbortSignal,
) => {
  return privateMutator<void>({
    url: `/api/configuration/shop-configuration/${id}/`,
    method: "DELETE",
    signal,
  });
};

export const getApiConfigurationShopConfigurationDestroyMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiConfigurationShopConfigurationDestroy>>,
    TError,
    { id: number },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiConfigurationShopConfigurationDestroy>>,
  TError,
  { id: number },
  TContext
> => {
  const mutationKey = ["apiConfigurationShopConfigurationDestroy"];
  const { mutation: mutationOptions } = options
    ? options.mutation &&
      "mutationKey" in options.mutation &&
      options.mutation.mutationKey
      ? options
      : { ...options, mutation: { ...options.mutation, mutationKey } }
    : { mutation: { mutationKey } };

  const mutationFn: MutationFunction<
    Awaited<ReturnType<typeof apiConfigurationShopConfigurationDestroy>>,
    { id: number }
  > = (props) => {
    const { id } = props ?? {};

    return apiConfigurationShopConfigurationDestroy(id);
  };

  return { mutationFn, ...mutationOptions };
};

export type ApiConfigurationShopConfigurationDestroyMutationResult =
  NonNullable<
    Awaited<ReturnType<typeof apiConfigurationShopConfigurationDestroy>>
  >;

export type ApiConfigurationShopConfigurationDestroyMutationError = unknown;

/**
 * @summary Delete site configuration (admin only)
 */
export const useApiConfigurationShopConfigurationDestroy = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiConfigurationShopConfigurationDestroy>>,
      TError,
      { id: number },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiConfigurationShopConfigurationDestroy>>,
  TError,
  { id: number },
  TContext
> => {
  return useMutation(
    getApiConfigurationShopConfigurationDestroyMutationOptions(options),
    queryClient,
  );
};
/**
 * VAT rate management - read for all, write for admins only
 * @summary List VAT rates
 */
export const apiConfigurationVatRatesList = (
  params?: ApiConfigurationVatRatesListParams,
  signal?: AbortSignal,
) => {
  return privateMutator<PaginatedVATRateList>({
    url: `/api/configuration/vat-rates/`,
    method: "GET",
    params,
    signal,
  });
};

export const getApiConfigurationVatRatesListQueryKey = (
  params?: ApiConfigurationVatRatesListParams,
) => {
  return [
    `/api/configuration/vat-rates/`,
    ...(params ? [params] : []),
  ] as const;
};

export const getApiConfigurationVatRatesListQueryOptions = <
  TData = Awaited<ReturnType<typeof apiConfigurationVatRatesList>>,
  TError = unknown,
>(
  params?: ApiConfigurationVatRatesListParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationVatRatesList>>,
        TError,
        TData
      >
    >;
  },
) => {
  const { query: queryOptions } = options ?? {};

  const queryKey =
    queryOptions?.queryKey ?? getApiConfigurationVatRatesListQueryKey(params);

  const queryFn: QueryFunction<
    Awaited<ReturnType<typeof apiConfigurationVatRatesList>>
  > = ({ signal }) => apiConfigurationVatRatesList(params, signal);

  return { queryKey, queryFn, ...queryOptions } as UseQueryOptions<
    Awaited<ReturnType<typeof apiConfigurationVatRatesList>>,
    TError,
    TData
  > & { queryKey: DataTag<QueryKey, TData, TError> };
};

export type ApiConfigurationVatRatesListQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiConfigurationVatRatesList>>
>;
export type ApiConfigurationVatRatesListQueryError = unknown;

export function useApiConfigurationVatRatesList<
  TData = Awaited<ReturnType<typeof apiConfigurationVatRatesList>>,
  TError = unknown,
>(
  params: undefined | ApiConfigurationVatRatesListParams,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationVatRatesList>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiConfigurationVatRatesList>>,
          TError,
          Awaited<ReturnType<typeof apiConfigurationVatRatesList>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiConfigurationVatRatesList<
  TData = Awaited<ReturnType<typeof apiConfigurationVatRatesList>>,
  TError = unknown,
>(
  params?: ApiConfigurationVatRatesListParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationVatRatesList>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiConfigurationVatRatesList>>,
          TError,
          Awaited<ReturnType<typeof apiConfigurationVatRatesList>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiConfigurationVatRatesList<
  TData = Awaited<ReturnType<typeof apiConfigurationVatRatesList>>,
  TError = unknown,
>(
  params?: ApiConfigurationVatRatesListParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationVatRatesList>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary List VAT rates
 */

export function useApiConfigurationVatRatesList<
  TData = Awaited<ReturnType<typeof apiConfigurationVatRatesList>>,
  TError = unknown,
>(
  params?: ApiConfigurationVatRatesListParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationVatRatesList>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions = getApiConfigurationVatRatesListQueryOptions(
    params,
    options,
  );

  const query = useQuery(queryOptions, queryClient) as UseQueryResult<
    TData,
    TError
  > & { queryKey: DataTag<QueryKey, TData, TError> };

  return { ...query, queryKey: queryOptions.queryKey };
}

/**
 * VAT rate management - read for all, write for admins only
 * @summary Create VAT rate (admin only)
 */
export const apiConfigurationVatRatesCreate = (
  vATRate: NonReadonly<VATRate>,
  signal?: AbortSignal,
) => {
  return privateMutator<VATRate>({
    url: `/api/configuration/vat-rates/`,
    method: "POST",
    headers: { "Content-Type": "application/json" },
    data: vATRate,
    signal,
  });
};

export const getApiConfigurationVatRatesCreateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiConfigurationVatRatesCreate>>,
    TError,
    { data: NonReadonly<VATRate> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiConfigurationVatRatesCreate>>,
  TError,
  { data: NonReadonly<VATRate> },
  TContext
> => {
  const mutationKey = ["apiConfigurationVatRatesCreate"];
  const { mutation: mutationOptions } = options
    ? options.mutation &&
      "mutationKey" in options.mutation &&
      options.mutation.mutationKey
      ? options
      : { ...options, mutation: { ...options.mutation, mutationKey } }
    : { mutation: { mutationKey } };

  const mutationFn: MutationFunction<
    Awaited<ReturnType<typeof apiConfigurationVatRatesCreate>>,
    { data: NonReadonly<VATRate> }
  > = (props) => {
    const { data } = props ?? {};

    return apiConfigurationVatRatesCreate(data);
  };

  return { mutationFn, ...mutationOptions };
};

export type ApiConfigurationVatRatesCreateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiConfigurationVatRatesCreate>>
>;
export type ApiConfigurationVatRatesCreateMutationBody = NonReadonly<VATRate>;
export type ApiConfigurationVatRatesCreateMutationError = unknown;

/**
 * @summary Create VAT rate (admin only)
 */
export const useApiConfigurationVatRatesCreate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiConfigurationVatRatesCreate>>,
      TError,
      { data: NonReadonly<VATRate> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiConfigurationVatRatesCreate>>,
  TError,
  { data: NonReadonly<VATRate> },
  TContext
> => {
  return useMutation(
    getApiConfigurationVatRatesCreateMutationOptions(options),
    queryClient,
  );
};
/**
 * VAT rate management - read for all, write for admins only
 * @summary Retrieve VAT rate
 */
export const apiConfigurationVatRatesRetrieve = (
  id: number,
  signal?: AbortSignal,
) => {
  return privateMutator<VATRate>({
    url: `/api/configuration/vat-rates/${id}/`,
    method: "GET",
    signal,
  });
};

export const getApiConfigurationVatRatesRetrieveQueryKey = (id: number) => {
  return [`/api/configuration/vat-rates/${id}/`] as const;
};

export const getApiConfigurationVatRatesRetrieveQueryOptions = <
  TData = Awaited<ReturnType<typeof apiConfigurationVatRatesRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationVatRatesRetrieve>>,
        TError,
        TData
      >
    >;
  },
) => {
  const { query: queryOptions } = options ?? {};

  const queryKey =
    queryOptions?.queryKey ?? getApiConfigurationVatRatesRetrieveQueryKey(id);

  const queryFn: QueryFunction<
    Awaited<ReturnType<typeof apiConfigurationVatRatesRetrieve>>
  > = ({ signal }) => apiConfigurationVatRatesRetrieve(id, signal);

  return {
    queryKey,
    queryFn,
    enabled: !!id,
    ...queryOptions,
  } as UseQueryOptions<
    Awaited<ReturnType<typeof apiConfigurationVatRatesRetrieve>>,
    TError,
    TData
  > & { queryKey: DataTag<QueryKey, TData, TError> };
};

export type ApiConfigurationVatRatesRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiConfigurationVatRatesRetrieve>>
>;
export type ApiConfigurationVatRatesRetrieveQueryError = unknown;

export function useApiConfigurationVatRatesRetrieve<
  TData = Awaited<ReturnType<typeof apiConfigurationVatRatesRetrieve>>,
  TError = unknown,
>(
  id: number,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationVatRatesRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiConfigurationVatRatesRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiConfigurationVatRatesRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiConfigurationVatRatesRetrieve<
  TData = Awaited<ReturnType<typeof apiConfigurationVatRatesRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationVatRatesRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiConfigurationVatRatesRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiConfigurationVatRatesRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiConfigurationVatRatesRetrieve<
  TData = Awaited<ReturnType<typeof apiConfigurationVatRatesRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationVatRatesRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary Retrieve VAT rate
 */

export function useApiConfigurationVatRatesRetrieve<
  TData = Awaited<ReturnType<typeof apiConfigurationVatRatesRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiConfigurationVatRatesRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions = getApiConfigurationVatRatesRetrieveQueryOptions(
    id,
    options,
  );

  const query = useQuery(queryOptions, queryClient) as UseQueryResult<
    TData,
    TError
  > & { queryKey: DataTag<QueryKey, TData, TError> };

  return { ...query, queryKey: queryOptions.queryKey };
}

/**
 * VAT rate management - read for all, write for admins only
 * @summary Replace VAT rate (admin only)
 */
export const apiConfigurationVatRatesUpdate = (
  id: number,
  vATRate: NonReadonly<VATRate>,
  signal?: AbortSignal,
) => {
  return privateMutator<VATRate>({
    url: `/api/configuration/vat-rates/${id}/`,
    method: "PUT",
    headers: { "Content-Type": "application/json" },
    data: vATRate,
    signal,
  });
};

export const getApiConfigurationVatRatesUpdateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiConfigurationVatRatesUpdate>>,
    TError,
    { id: number; data: NonReadonly<VATRate> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiConfigurationVatRatesUpdate>>,
  TError,
  { id: number; data: NonReadonly<VATRate> },
  TContext
> => {
  const mutationKey = ["apiConfigurationVatRatesUpdate"];
  const { mutation: mutationOptions } = options
    ? options.mutation &&
      "mutationKey" in options.mutation &&
      options.mutation.mutationKey
      ? options
      : { ...options, mutation: { ...options.mutation, mutationKey } }
    : { mutation: { mutationKey } };

  const mutationFn: MutationFunction<
    Awaited<ReturnType<typeof apiConfigurationVatRatesUpdate>>,
    { id: number; data: NonReadonly<VATRate> }
  > = (props) => {
    const { id, data } = props ?? {};

    return apiConfigurationVatRatesUpdate(id, data);
  };

  return { mutationFn, ...mutationOptions };
};

export type ApiConfigurationVatRatesUpdateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiConfigurationVatRatesUpdate>>
>;
export type ApiConfigurationVatRatesUpdateMutationBody = NonReadonly<VATRate>;
export type ApiConfigurationVatRatesUpdateMutationError = unknown;

/**
 * @summary Replace VAT rate (admin only)
 */
export const useApiConfigurationVatRatesUpdate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiConfigurationVatRatesUpdate>>,
      TError,
      { id: number; data: NonReadonly<VATRate> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiConfigurationVatRatesUpdate>>,
  TError,
  { id: number; data: NonReadonly<VATRate> },
  TContext
> => {
  return useMutation(
    getApiConfigurationVatRatesUpdateMutationOptions(options),
    queryClient,
  );
};
/**
 * VAT rate management - read for all, write for admins only
 * @summary Update VAT rate (admin only)
 */
export const apiConfigurationVatRatesPartialUpdate = (
  id: number,
  patchedVATRate: NonReadonly<PatchedVATRate>,
  signal?: AbortSignal,
) => {
  return privateMutator<VATRate>({
    url: `/api/configuration/vat-rates/${id}/`,
    method: "PATCH",
    headers: { "Content-Type": "application/json" },
    data: patchedVATRate,
    signal,
  });
};

export const getApiConfigurationVatRatesPartialUpdateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiConfigurationVatRatesPartialUpdate>>,
    TError,
    { id: number; data: NonReadonly<PatchedVATRate> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiConfigurationVatRatesPartialUpdate>>,
  TError,
  { id: number; data: NonReadonly<PatchedVATRate> },
  TContext
> => {
  const mutationKey = ["apiConfigurationVatRatesPartialUpdate"];
  const { mutation: mutationOptions } = options
    ? options.mutation &&
      "mutationKey" in options.mutation &&
      options.mutation.mutationKey
      ? options
      : { ...options, mutation: { ...options.mutation, mutationKey } }
    : { mutation: { mutationKey } };

  const mutationFn: MutationFunction<
    Awaited<ReturnType<typeof apiConfigurationVatRatesPartialUpdate>>,
    { id: number; data: NonReadonly<PatchedVATRate> }
  > = (props) => {
    const { id, data } = props ?? {};

    return apiConfigurationVatRatesPartialUpdate(id, data);
  };

  return { mutationFn, ...mutationOptions };
};

export type ApiConfigurationVatRatesPartialUpdateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiConfigurationVatRatesPartialUpdate>>
>;
export type ApiConfigurationVatRatesPartialUpdateMutationBody =
  NonReadonly<PatchedVATRate>;
export type ApiConfigurationVatRatesPartialUpdateMutationError = unknown;

/**
 * @summary Update VAT rate (admin only)
 */
export const useApiConfigurationVatRatesPartialUpdate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiConfigurationVatRatesPartialUpdate>>,
      TError,
      { id: number; data: NonReadonly<PatchedVATRate> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiConfigurationVatRatesPartialUpdate>>,
  TError,
  { id: number; data: NonReadonly<PatchedVATRate> },
  TContext
> => {
  return useMutation(
    getApiConfigurationVatRatesPartialUpdateMutationOptions(options),
    queryClient,
  );
};
/**
 * VAT rate management - read for all, write for admins only
 * @summary Delete VAT rate (admin only)
 */
export const apiConfigurationVatRatesDestroy = (
  id: number,
  signal?: AbortSignal,
) => {
  return privateMutator<void>({
    url: `/api/configuration/vat-rates/${id}/`,
    method: "DELETE",
    signal,
  });
};

export const getApiConfigurationVatRatesDestroyMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiConfigurationVatRatesDestroy>>,
    TError,
    { id: number },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiConfigurationVatRatesDestroy>>,
  TError,
  { id: number },
  TContext
> => {
  const mutationKey = ["apiConfigurationVatRatesDestroy"];
  const { mutation: mutationOptions } = options
    ? options.mutation &&
      "mutationKey" in options.mutation &&
      options.mutation.mutationKey
      ? options
      : { ...options, mutation: { ...options.mutation, mutationKey } }
    : { mutation: { mutationKey } };

  const mutationFn: MutationFunction<
    Awaited<ReturnType<typeof apiConfigurationVatRatesDestroy>>,
    { id: number }
  > = (props) => {
    const { id } = props ?? {};

    return apiConfigurationVatRatesDestroy(id);
  };

  return { mutationFn, ...mutationOptions };
};

export type ApiConfigurationVatRatesDestroyMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiConfigurationVatRatesDestroy>>
>;

export type ApiConfigurationVatRatesDestroyMutationError = unknown;

/**
 * @summary Delete VAT rate (admin only)
 */
export const useApiConfigurationVatRatesDestroy = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiConfigurationVatRatesDestroy>>,
      TError,
      { id: number },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiConfigurationVatRatesDestroy>>,
  TError,
  { id: number },
  TContext
> => {
  return useMutation(
    getApiConfigurationVatRatesDestroyMutationOptions(options),
    queryClient,
  );
};
/**
 * Set this VAT rate as the default for new products
 * @summary Make VAT rate the default (admin only)
 */
export const apiConfigurationVatRatesMakeDefaultCreate = (
  id: number,
  vATRate: NonReadonly<VATRate>,
  signal?: AbortSignal,
) => {
  return privateMutator<VATRate>({
    url: `/api/configuration/vat-rates/${id}/make_default/`,
    method: "POST",
    headers: { "Content-Type": "application/json" },
    data: vATRate,
    signal,
  });
};

export const getApiConfigurationVatRatesMakeDefaultCreateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiConfigurationVatRatesMakeDefaultCreate>>,
    TError,
    { id: number; data: NonReadonly<VATRate> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiConfigurationVatRatesMakeDefaultCreate>>,
  TError,
  { id: number; data: NonReadonly<VATRate> },
  TContext
> => {
  const mutationKey = ["apiConfigurationVatRatesMakeDefaultCreate"];
  const { mutation: mutationOptions } = options
    ? options.mutation &&
      "mutationKey" in options.mutation &&
      options.mutation.mutationKey
      ? options
      : { ...options, mutation: { ...options.mutation, mutationKey } }
    : { mutation: { mutationKey } };

  const mutationFn: MutationFunction<
    Awaited<ReturnType<typeof apiConfigurationVatRatesMakeDefaultCreate>>,
    { id: number; data: NonReadonly<VATRate> }
  > = (props) => {
    const { id, data } = props ?? {};

    return apiConfigurationVatRatesMakeDefaultCreate(id, data);
  };

  return { mutationFn, ...mutationOptions };
};

export type ApiConfigurationVatRatesMakeDefaultCreateMutationResult =
  NonNullable<
    Awaited<ReturnType<typeof apiConfigurationVatRatesMakeDefaultCreate>>
  >;
export type ApiConfigurationVatRatesMakeDefaultCreateMutationBody =
  NonReadonly<VATRate>;
export type ApiConfigurationVatRatesMakeDefaultCreateMutationError = unknown;

/**
 * @summary Make VAT rate the default (admin only)
 */
export const useApiConfigurationVatRatesMakeDefaultCreate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiConfigurationVatRatesMakeDefaultCreate>>,
      TError,
      { id: number; data: NonReadonly<VATRate> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiConfigurationVatRatesMakeDefaultCreate>>,
  TError,
  { id: number; data: NonReadonly<VATRate> },
  TContext
> => {
  return useMutation(
    getApiConfigurationVatRatesMakeDefaultCreateMutationOptions(options),
    queryClient,
  );
};
