/**
 * 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 {
  ApiCommerceReviewsListParams,
  ApiSchemaRetrieve200Four,
  ApiSchemaRetrieve200One,
  ApiSchemaRetrieve200Three,
  ApiSchemaRetrieve200Two,
  ApiSchemaRetrieveParams,
  Cart,
  Message,
  OrderMini,
  OrderRead,
  PaginatedReviewSerializerPublicList,
  PatchedCart,
  PatchedOrderRead,
  PatchedReviewSerializerPublic,
  Product,
  ReviewSerializerPublic,
  Wishlist,
} 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>;

/**
 * Admin-only wishlist management - can view and modify any user's wishlist
 */
export const apiCommerceAdminWishlistsCreate = (
  wishlist: NonReadonly<Wishlist>,
  signal?: AbortSignal,
) => {
  return privateMutator<Wishlist>({
    url: `/api/commerce/admin/wishlists/`,
    method: "POST",
    headers: { "Content-Type": "application/json" },
    data: wishlist,
    signal,
  });
};

export const getApiCommerceAdminWishlistsCreateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiCommerceAdminWishlistsCreate>>,
    TError,
    { data: NonReadonly<Wishlist> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiCommerceAdminWishlistsCreate>>,
  TError,
  { data: NonReadonly<Wishlist> },
  TContext
> => {
  const mutationKey = ["apiCommerceAdminWishlistsCreate"];
  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 apiCommerceAdminWishlistsCreate>>,
    { data: NonReadonly<Wishlist> }
  > = (props) => {
    const { data } = props ?? {};

    return apiCommerceAdminWishlistsCreate(data);
  };

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

export type ApiCommerceAdminWishlistsCreateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceAdminWishlistsCreate>>
>;
export type ApiCommerceAdminWishlistsCreateMutationBody = NonReadonly<Wishlist>;
export type ApiCommerceAdminWishlistsCreateMutationError = unknown;

export const useApiCommerceAdminWishlistsCreate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiCommerceAdminWishlistsCreate>>,
      TError,
      { data: NonReadonly<Wishlist> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiCommerceAdminWishlistsCreate>>,
  TError,
  { data: NonReadonly<Wishlist> },
  TContext
> => {
  return useMutation(
    getApiCommerceAdminWishlistsCreateMutationOptions(options),
    queryClient,
  );
};
/**
 * Add a product to the cart or update quantity if already exists
 */
export const apiCommerceCartAddCreate = (
  cart: NonReadonly<Cart>,
  signal?: AbortSignal,
) => {
  return privateMutator<Cart>({
    url: `/api/commerce/cart/add/`,
    method: "POST",
    headers: { "Content-Type": "application/json" },
    data: cart,
    signal,
  });
};

export const getApiCommerceCartAddCreateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiCommerceCartAddCreate>>,
    TError,
    { data: NonReadonly<Cart> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiCommerceCartAddCreate>>,
  TError,
  { data: NonReadonly<Cart> },
  TContext
> => {
  const mutationKey = ["apiCommerceCartAddCreate"];
  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 apiCommerceCartAddCreate>>,
    { data: NonReadonly<Cart> }
  > = (props) => {
    const { data } = props ?? {};

    return apiCommerceCartAddCreate(data);
  };

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

export type ApiCommerceCartAddCreateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceCartAddCreate>>
>;
export type ApiCommerceCartAddCreateMutationBody = NonReadonly<Cart>;
export type ApiCommerceCartAddCreateMutationError = unknown;

export const useApiCommerceCartAddCreate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiCommerceCartAddCreate>>,
      TError,
      { data: NonReadonly<Cart> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiCommerceCartAddCreate>>,
  TError,
  { data: NonReadonly<Cart> },
  TContext
> => {
  return useMutation(
    getApiCommerceCartAddCreateMutationOptions(options),
    queryClient,
  );
};
/**
 * Remove all items from the cart
 */
export const apiCommerceCartClearCreate = (
  cart: NonReadonly<Cart>,
  signal?: AbortSignal,
) => {
  return privateMutator<Cart>({
    url: `/api/commerce/cart/clear/`,
    method: "POST",
    headers: { "Content-Type": "application/json" },
    data: cart,
    signal,
  });
};

export const getApiCommerceCartClearCreateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiCommerceCartClearCreate>>,
    TError,
    { data: NonReadonly<Cart> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiCommerceCartClearCreate>>,
  TError,
  { data: NonReadonly<Cart> },
  TContext
> => {
  const mutationKey = ["apiCommerceCartClearCreate"];
  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 apiCommerceCartClearCreate>>,
    { data: NonReadonly<Cart> }
  > = (props) => {
    const { data } = props ?? {};

    return apiCommerceCartClearCreate(data);
  };

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

export type ApiCommerceCartClearCreateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceCartClearCreate>>
>;
export type ApiCommerceCartClearCreateMutationBody = NonReadonly<Cart>;
export type ApiCommerceCartClearCreateMutationError = unknown;

export const useApiCommerceCartClearCreate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiCommerceCartClearCreate>>,
      TError,
      { data: NonReadonly<Cart> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiCommerceCartClearCreate>>,
  TError,
  { data: NonReadonly<Cart> },
  TContext
> => {
  return useMutation(
    getApiCommerceCartClearCreateMutationOptions(options),
    queryClient,
  );
};
/**
 * Get the current user's cart
 */
export const apiCommerceCartCurrentRetrieve = (signal?: AbortSignal) => {
  return privateMutator<Cart>({
    url: `/api/commerce/cart/current/`,
    method: "GET",
    signal,
  });
};

export const getApiCommerceCartCurrentRetrieveQueryKey = () => {
  return [`/api/commerce/cart/current/`] as const;
};

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

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

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

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

export type ApiCommerceCartCurrentRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceCartCurrentRetrieve>>
>;
export type ApiCommerceCartCurrentRetrieveQueryError = unknown;

export function useApiCommerceCartCurrentRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceCartCurrentRetrieve>>,
  TError = unknown,
>(
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceCartCurrentRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceCartCurrentRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceCartCurrentRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceCartCurrentRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceCartCurrentRetrieve>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceCartCurrentRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceCartCurrentRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceCartCurrentRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceCartCurrentRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceCartCurrentRetrieve>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceCartCurrentRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};

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

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

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

/**
 * Update quantity of a cart item
 */
export const apiCommerceCartItemsPartialUpdate = (
  itemId: string,
  patchedCart: NonReadonly<PatchedCart>,
  signal?: AbortSignal,
) => {
  return privateMutator<Cart>({
    url: `/api/commerce/cart/items/${itemId}/`,
    method: "PATCH",
    headers: { "Content-Type": "application/json" },
    data: patchedCart,
    signal,
  });
};

export const getApiCommerceCartItemsPartialUpdateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiCommerceCartItemsPartialUpdate>>,
    TError,
    { itemId: string; data: NonReadonly<PatchedCart> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiCommerceCartItemsPartialUpdate>>,
  TError,
  { itemId: string; data: NonReadonly<PatchedCart> },
  TContext
> => {
  const mutationKey = ["apiCommerceCartItemsPartialUpdate"];
  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 apiCommerceCartItemsPartialUpdate>>,
    { itemId: string; data: NonReadonly<PatchedCart> }
  > = (props) => {
    const { itemId, data } = props ?? {};

    return apiCommerceCartItemsPartialUpdate(itemId, data);
  };

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

export type ApiCommerceCartItemsPartialUpdateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceCartItemsPartialUpdate>>
>;
export type ApiCommerceCartItemsPartialUpdateMutationBody =
  NonReadonly<PatchedCart>;
export type ApiCommerceCartItemsPartialUpdateMutationError = unknown;

export const useApiCommerceCartItemsPartialUpdate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiCommerceCartItemsPartialUpdate>>,
      TError,
      { itemId: string; data: NonReadonly<PatchedCart> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiCommerceCartItemsPartialUpdate>>,
  TError,
  { itemId: string; data: NonReadonly<PatchedCart> },
  TContext
> => {
  return useMutation(
    getApiCommerceCartItemsPartialUpdateMutationOptions(options),
    queryClient,
  );
};
/**
 * Remove an item from the cart
 */
export const apiCommerceCartItemsDestroy = (
  itemId: string,
  signal?: AbortSignal,
) => {
  return privateMutator<void>({
    url: `/api/commerce/cart/items/${itemId}/`,
    method: "DELETE",
    signal,
  });
};

export const getApiCommerceCartItemsDestroyMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiCommerceCartItemsDestroy>>,
    TError,
    { itemId: string },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiCommerceCartItemsDestroy>>,
  TError,
  { itemId: string },
  TContext
> => {
  const mutationKey = ["apiCommerceCartItemsDestroy"];
  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 apiCommerceCartItemsDestroy>>,
    { itemId: string }
  > = (props) => {
    const { itemId } = props ?? {};

    return apiCommerceCartItemsDestroy(itemId);
  };

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

export type ApiCommerceCartItemsDestroyMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceCartItemsDestroy>>
>;

export type ApiCommerceCartItemsDestroyMutationError = unknown;

export const useApiCommerceCartItemsDestroy = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiCommerceCartItemsDestroy>>,
      TError,
      { itemId: string },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiCommerceCartItemsDestroy>>,
  TError,
  { itemId: string },
  TContext
> => {
  return useMutation(
    getApiCommerceCartItemsDestroyMutationOptions(options),
    queryClient,
  );
};
export const apiCommerceOrdersCancelCreate = (
  id: number,
  orderRead: NonReadonly<OrderRead>,
  signal?: AbortSignal,
) => {
  return privateMutator<OrderRead>({
    url: `/api/commerce/orders/${id}/cancel/`,
    method: "POST",
    headers: { "Content-Type": "application/json" },
    data: orderRead,
    signal,
  });
};

export const getApiCommerceOrdersCancelCreateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiCommerceOrdersCancelCreate>>,
    TError,
    { id: number; data: NonReadonly<OrderRead> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiCommerceOrdersCancelCreate>>,
  TError,
  { id: number; data: NonReadonly<OrderRead> },
  TContext
> => {
  const mutationKey = ["apiCommerceOrdersCancelCreate"];
  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 apiCommerceOrdersCancelCreate>>,
    { id: number; data: NonReadonly<OrderRead> }
  > = (props) => {
    const { id, data } = props ?? {};

    return apiCommerceOrdersCancelCreate(id, data);
  };

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

export type ApiCommerceOrdersCancelCreateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceOrdersCancelCreate>>
>;
export type ApiCommerceOrdersCancelCreateMutationBody = NonReadonly<OrderRead>;
export type ApiCommerceOrdersCancelCreateMutationError = unknown;

export const useApiCommerceOrdersCancelCreate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiCommerceOrdersCancelCreate>>,
      TError,
      { id: number; data: NonReadonly<OrderRead> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiCommerceOrdersCancelCreate>>,
  TError,
  { id: number; data: NonReadonly<OrderRead> },
  TContext
> => {
  return useMutation(
    getApiCommerceOrdersCancelCreateMutationOptions(options),
    queryClient,
  );
};
export const apiCommerceOrdersCarrierRetrieve = (
  id: number,
  signal?: AbortSignal,
) => {
  return privateMutator<OrderRead>({
    url: `/api/commerce/orders/${id}/carrier/`,
    method: "GET",
    signal,
  });
};

export const getApiCommerceOrdersCarrierRetrieveQueryKey = (id: number) => {
  return [`/api/commerce/orders/${id}/carrier/`] as const;
};

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

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

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

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

export type ApiCommerceOrdersCarrierRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceOrdersCarrierRetrieve>>
>;
export type ApiCommerceOrdersCarrierRetrieveQueryError = unknown;

export function useApiCommerceOrdersCarrierRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceOrdersCarrierRetrieve>>,
  TError = unknown,
>(
  id: number,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceOrdersCarrierRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceOrdersCarrierRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceOrdersCarrierRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceOrdersCarrierRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceOrdersCarrierRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceOrdersCarrierRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceOrdersCarrierRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceOrdersCarrierRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceOrdersCarrierRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceOrdersCarrierRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceOrdersCarrierRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};

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

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

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

export const apiCommerceOrdersCarrierReadyToPickupPartialUpdate = (
  id: number,
  patchedOrderRead: NonReadonly<PatchedOrderRead>,
  signal?: AbortSignal,
) => {
  return privateMutator<OrderRead>({
    url: `/api/commerce/orders/${id}/carrier/ready-to-pickup/`,
    method: "PATCH",
    headers: { "Content-Type": "application/json" },
    data: patchedOrderRead,
    signal,
  });
};

export const getApiCommerceOrdersCarrierReadyToPickupPartialUpdateMutationOptions =
  <TError = unknown, TContext = unknown>(options?: {
    mutation?: UseMutationOptions<
      Awaited<
        ReturnType<typeof apiCommerceOrdersCarrierReadyToPickupPartialUpdate>
      >,
      TError,
      { id: number; data: NonReadonly<PatchedOrderRead> },
      TContext
    >;
  }): UseMutationOptions<
    Awaited<
      ReturnType<typeof apiCommerceOrdersCarrierReadyToPickupPartialUpdate>
    >,
    TError,
    { id: number; data: NonReadonly<PatchedOrderRead> },
    TContext
  > => {
    const mutationKey = ["apiCommerceOrdersCarrierReadyToPickupPartialUpdate"];
    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 apiCommerceOrdersCarrierReadyToPickupPartialUpdate>
      >,
      { id: number; data: NonReadonly<PatchedOrderRead> }
    > = (props) => {
      const { id, data } = props ?? {};

      return apiCommerceOrdersCarrierReadyToPickupPartialUpdate(id, data);
    };

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

export type ApiCommerceOrdersCarrierReadyToPickupPartialUpdateMutationResult =
  NonNullable<
    Awaited<
      ReturnType<typeof apiCommerceOrdersCarrierReadyToPickupPartialUpdate>
    >
  >;
export type ApiCommerceOrdersCarrierReadyToPickupPartialUpdateMutationBody =
  NonReadonly<PatchedOrderRead>;
export type ApiCommerceOrdersCarrierReadyToPickupPartialUpdateMutationError =
  unknown;

export const useApiCommerceOrdersCarrierReadyToPickupPartialUpdate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<
        ReturnType<typeof apiCommerceOrdersCarrierReadyToPickupPartialUpdate>
      >,
      TError,
      { id: number; data: NonReadonly<PatchedOrderRead> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<
    ReturnType<typeof apiCommerceOrdersCarrierReadyToPickupPartialUpdate>
  >,
  TError,
  { id: number; data: NonReadonly<PatchedOrderRead> },
  TContext
> => {
  return useMutation(
    getApiCommerceOrdersCarrierReadyToPickupPartialUpdateMutationOptions(
      options,
    ),
    queryClient,
  );
};
export const apiCommerceOrdersCarrierStartOrderingShippingPartialUpdate = (
  id: number,
  patchedOrderRead: NonReadonly<PatchedOrderRead>,
  signal?: AbortSignal,
) => {
  return privateMutator<OrderRead>({
    url: `/api/commerce/orders/${id}/carrier/start-ordering-shipping/`,
    method: "PATCH",
    headers: { "Content-Type": "application/json" },
    data: patchedOrderRead,
    signal,
  });
};

export const getApiCommerceOrdersCarrierStartOrderingShippingPartialUpdateMutationOptions =
  <TError = unknown, TContext = unknown>(options?: {
    mutation?: UseMutationOptions<
      Awaited<
        ReturnType<
          typeof apiCommerceOrdersCarrierStartOrderingShippingPartialUpdate
        >
      >,
      TError,
      { id: number; data: NonReadonly<PatchedOrderRead> },
      TContext
    >;
  }): UseMutationOptions<
    Awaited<
      ReturnType<
        typeof apiCommerceOrdersCarrierStartOrderingShippingPartialUpdate
      >
    >,
    TError,
    { id: number; data: NonReadonly<PatchedOrderRead> },
    TContext
  > => {
    const mutationKey = [
      "apiCommerceOrdersCarrierStartOrderingShippingPartialUpdate",
    ];
    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 apiCommerceOrdersCarrierStartOrderingShippingPartialUpdate
        >
      >,
      { id: number; data: NonReadonly<PatchedOrderRead> }
    > = (props) => {
      const { id, data } = props ?? {};

      return apiCommerceOrdersCarrierStartOrderingShippingPartialUpdate(
        id,
        data,
      );
    };

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

export type ApiCommerceOrdersCarrierStartOrderingShippingPartialUpdateMutationResult =
  NonNullable<
    Awaited<
      ReturnType<
        typeof apiCommerceOrdersCarrierStartOrderingShippingPartialUpdate
      >
    >
  >;
export type ApiCommerceOrdersCarrierStartOrderingShippingPartialUpdateMutationBody =
  NonReadonly<PatchedOrderRead>;
export type ApiCommerceOrdersCarrierStartOrderingShippingPartialUpdateMutationError =
  unknown;

export const useApiCommerceOrdersCarrierStartOrderingShippingPartialUpdate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<
        ReturnType<
          typeof apiCommerceOrdersCarrierStartOrderingShippingPartialUpdate
        >
      >,
      TError,
      { id: number; data: NonReadonly<PatchedOrderRead> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<
    ReturnType<
      typeof apiCommerceOrdersCarrierStartOrderingShippingPartialUpdate
    >
  >,
  TError,
  { id: number; data: NonReadonly<PatchedOrderRead> },
  TContext
> => {
  return useMutation(
    getApiCommerceOrdersCarrierStartOrderingShippingPartialUpdateMutationOptions(
      options,
    ),
    queryClient,
  );
};
export const apiCommerceOrdersInvoiceRetrieve = (
  id: number,
  signal?: AbortSignal,
) => {
  return privateMutator<OrderRead>({
    url: `/api/commerce/orders/${id}/invoice/`,
    method: "GET",
    signal,
  });
};

export const getApiCommerceOrdersInvoiceRetrieveQueryKey = (id: number) => {
  return [`/api/commerce/orders/${id}/invoice/`] as const;
};

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

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

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

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

export type ApiCommerceOrdersInvoiceRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceOrdersInvoiceRetrieve>>
>;
export type ApiCommerceOrdersInvoiceRetrieveQueryError = unknown;

export function useApiCommerceOrdersInvoiceRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceOrdersInvoiceRetrieve>>,
  TError = unknown,
>(
  id: number,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceOrdersInvoiceRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceOrdersInvoiceRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceOrdersInvoiceRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceOrdersInvoiceRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceOrdersInvoiceRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceOrdersInvoiceRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceOrdersInvoiceRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceOrdersInvoiceRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceOrdersInvoiceRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceOrdersInvoiceRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceOrdersInvoiceRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};

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

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

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

export const apiCommerceOrdersItemsRetrieve = (
  id: number,
  signal?: AbortSignal,
) => {
  return privateMutator<OrderRead>({
    url: `/api/commerce/orders/${id}/items/`,
    method: "GET",
    signal,
  });
};

export const getApiCommerceOrdersItemsRetrieveQueryKey = (id: number) => {
  return [`/api/commerce/orders/${id}/items/`] as const;
};

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

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

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

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

export type ApiCommerceOrdersItemsRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceOrdersItemsRetrieve>>
>;
export type ApiCommerceOrdersItemsRetrieveQueryError = unknown;

export function useApiCommerceOrdersItemsRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceOrdersItemsRetrieve>>,
  TError = unknown,
>(
  id: number,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceOrdersItemsRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceOrdersItemsRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceOrdersItemsRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceOrdersItemsRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceOrdersItemsRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceOrdersItemsRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceOrdersItemsRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceOrdersItemsRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceOrdersItemsRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceOrdersItemsRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceOrdersItemsRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};

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

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

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

export const apiCommerceOrdersPaymentRetrieve = (
  id: number,
  signal?: AbortSignal,
) => {
  return privateMutator<OrderRead>({
    url: `/api/commerce/orders/${id}/payment/`,
    method: "GET",
    signal,
  });
};

export const getApiCommerceOrdersPaymentRetrieveQueryKey = (id: number) => {
  return [`/api/commerce/orders/${id}/payment/`] as const;
};

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

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

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

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

export type ApiCommerceOrdersPaymentRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceOrdersPaymentRetrieve>>
>;
export type ApiCommerceOrdersPaymentRetrieveQueryError = unknown;

export function useApiCommerceOrdersPaymentRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceOrdersPaymentRetrieve>>,
  TError = unknown,
>(
  id: number,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceOrdersPaymentRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceOrdersPaymentRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceOrdersPaymentRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceOrdersPaymentRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceOrdersPaymentRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceOrdersPaymentRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceOrdersPaymentRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceOrdersPaymentRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceOrdersPaymentRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceOrdersPaymentRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceOrdersPaymentRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};

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

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

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

export const apiCommerceOrdersPaymentVerifyCreate = (
  id: number,
  orderRead: NonReadonly<OrderRead>,
  signal?: AbortSignal,
) => {
  return privateMutator<OrderRead>({
    url: `/api/commerce/orders/${id}/payment/verify/`,
    method: "POST",
    headers: { "Content-Type": "application/json" },
    data: orderRead,
    signal,
  });
};

export const getApiCommerceOrdersPaymentVerifyCreateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiCommerceOrdersPaymentVerifyCreate>>,
    TError,
    { id: number; data: NonReadonly<OrderRead> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiCommerceOrdersPaymentVerifyCreate>>,
  TError,
  { id: number; data: NonReadonly<OrderRead> },
  TContext
> => {
  const mutationKey = ["apiCommerceOrdersPaymentVerifyCreate"];
  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 apiCommerceOrdersPaymentVerifyCreate>>,
    { id: number; data: NonReadonly<OrderRead> }
  > = (props) => {
    const { id, data } = props ?? {};

    return apiCommerceOrdersPaymentVerifyCreate(id, data);
  };

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

export type ApiCommerceOrdersPaymentVerifyCreateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceOrdersPaymentVerifyCreate>>
>;
export type ApiCommerceOrdersPaymentVerifyCreateMutationBody =
  NonReadonly<OrderRead>;
export type ApiCommerceOrdersPaymentVerifyCreateMutationError = unknown;

export const useApiCommerceOrdersPaymentVerifyCreate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiCommerceOrdersPaymentVerifyCreate>>,
      TError,
      { id: number; data: NonReadonly<OrderRead> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiCommerceOrdersPaymentVerifyCreate>>,
  TError,
  { id: number; data: NonReadonly<OrderRead> },
  TContext
> => {
  return useMutation(
    getApiCommerceOrdersPaymentVerifyCreateMutationOptions(options),
    queryClient,
  );
};
export const apiCommerceOrdersDetailRetrieve = (signal?: AbortSignal) => {
  return privateMutator<OrderMini>({
    url: `/api/commerce/orders/detail/`,
    method: "GET",
    signal,
  });
};

export const getApiCommerceOrdersDetailRetrieveQueryKey = () => {
  return [`/api/commerce/orders/detail/`] as const;
};

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

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

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

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

export type ApiCommerceOrdersDetailRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceOrdersDetailRetrieve>>
>;
export type ApiCommerceOrdersDetailRetrieveQueryError = unknown;

export function useApiCommerceOrdersDetailRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceOrdersDetailRetrieve>>,
  TError = unknown,
>(
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceOrdersDetailRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceOrdersDetailRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceOrdersDetailRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceOrdersDetailRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceOrdersDetailRetrieve>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceOrdersDetailRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceOrdersDetailRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceOrdersDetailRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceOrdersDetailRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceOrdersDetailRetrieve>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceOrdersDetailRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};

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

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

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

export const apiCommerceProductsAvailabilityRetrieve = (
  id: number,
  signal?: AbortSignal,
) => {
  return privateMutator<Product>({
    url: `/api/commerce/products/${id}/availability/`,
    method: "GET",
    signal,
  });
};

export const getApiCommerceProductsAvailabilityRetrieveQueryKey = (
  id: number,
) => {
  return [`/api/commerce/products/${id}/availability/`] as const;
};

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

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

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

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

export type ApiCommerceProductsAvailabilityRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceProductsAvailabilityRetrieve>>
>;
export type ApiCommerceProductsAvailabilityRetrieveQueryError = unknown;

export function useApiCommerceProductsAvailabilityRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceProductsAvailabilityRetrieve>>,
  TError = unknown,
>(
  id: number,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceProductsAvailabilityRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceProductsAvailabilityRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceProductsAvailabilityRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceProductsAvailabilityRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceProductsAvailabilityRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceProductsAvailabilityRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceProductsAvailabilityRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceProductsAvailabilityRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceProductsAvailabilityRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceProductsAvailabilityRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceProductsAvailabilityRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};

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

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

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

export const apiCommerceProductsRatingRetrieve = (
  id: number,
  signal?: AbortSignal,
) => {
  return privateMutator<Product>({
    url: `/api/commerce/products/${id}/rating/`,
    method: "GET",
    signal,
  });
};

export const getApiCommerceProductsRatingRetrieveQueryKey = (id: number) => {
  return [`/api/commerce/products/${id}/rating/`] as const;
};

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

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

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

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

export type ApiCommerceProductsRatingRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceProductsRatingRetrieve>>
>;
export type ApiCommerceProductsRatingRetrieveQueryError = unknown;

export function useApiCommerceProductsRatingRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceProductsRatingRetrieve>>,
  TError = unknown,
>(
  id: number,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceProductsRatingRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceProductsRatingRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceProductsRatingRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceProductsRatingRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceProductsRatingRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceProductsRatingRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceProductsRatingRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceProductsRatingRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceProductsRatingRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceProductsRatingRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceProductsRatingRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};

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

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

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

/**
 * Public endpoint to create and fetch refund objects.

POST: Create a refund given email and invoice_number or order_id.
          Returns JSON with refund info, order items, and a base64 PDF payload.
GET:  Return a refund object by id (query param `id`).
 */
export const apiCommerceRefundsPublicRetrieve = (signal?: AbortSignal) => {
  return privateMutator<void>({
    url: `/api/commerce/refunds/public/`,
    method: "GET",
    signal,
  });
};

export const getApiCommerceRefundsPublicRetrieveQueryKey = () => {
  return [`/api/commerce/refunds/public/`] as const;
};

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

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

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

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

export type ApiCommerceRefundsPublicRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceRefundsPublicRetrieve>>
>;
export type ApiCommerceRefundsPublicRetrieveQueryError = unknown;

export function useApiCommerceRefundsPublicRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceRefundsPublicRetrieve>>,
  TError = unknown,
>(
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceRefundsPublicRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceRefundsPublicRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceRefundsPublicRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceRefundsPublicRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceRefundsPublicRetrieve>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceRefundsPublicRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceRefundsPublicRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceRefundsPublicRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceRefundsPublicRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceRefundsPublicRetrieve>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceRefundsPublicRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};

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

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

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

/**
 * Public endpoint to create and fetch refund objects.

POST: Create a refund given email and invoice_number or order_id.
          Returns JSON with refund info, order items, and a base64 PDF payload.
GET:  Return a refund object by id (query param `id`).
 */
export const apiCommerceRefundsPublicCreate = (signal?: AbortSignal) => {
  return privateMutator<void>({
    url: `/api/commerce/refunds/public/`,
    method: "POST",
    signal,
  });
};

export const getApiCommerceRefundsPublicCreateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiCommerceRefundsPublicCreate>>,
    TError,
    void,
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiCommerceRefundsPublicCreate>>,
  TError,
  void,
  TContext
> => {
  const mutationKey = ["apiCommerceRefundsPublicCreate"];
  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 apiCommerceRefundsPublicCreate>>,
    void
  > = () => {
    return apiCommerceRefundsPublicCreate();
  };

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

export type ApiCommerceRefundsPublicCreateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceRefundsPublicCreate>>
>;

export type ApiCommerceRefundsPublicCreateMutationError = unknown;

export const useApiCommerceRefundsPublicCreate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiCommerceRefundsPublicCreate>>,
      TError,
      void,
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiCommerceRefundsPublicCreate>>,
  TError,
  void,
  TContext
> => {
  return useMutation(
    getApiCommerceRefundsPublicCreateMutationOptions(options),
    queryClient,
  );
};
export const apiCommerceReviewsList = (
  params?: ApiCommerceReviewsListParams,
  signal?: AbortSignal,
) => {
  return privateMutator<PaginatedReviewSerializerPublicList>({
    url: `/api/commerce/reviews/`,
    method: "GET",
    params,
    signal,
  });
};

export const getApiCommerceReviewsListQueryKey = (
  params?: ApiCommerceReviewsListParams,
) => {
  return [`/api/commerce/reviews/`, ...(params ? [params] : [])] as const;
};

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

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

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

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

export type ApiCommerceReviewsListQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceReviewsList>>
>;
export type ApiCommerceReviewsListQueryError = unknown;

export function useApiCommerceReviewsList<
  TData = Awaited<ReturnType<typeof apiCommerceReviewsList>>,
  TError = unknown,
>(
  params: undefined | ApiCommerceReviewsListParams,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceReviewsList>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceReviewsList>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceReviewsList>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceReviewsList<
  TData = Awaited<ReturnType<typeof apiCommerceReviewsList>>,
  TError = unknown,
>(
  params?: ApiCommerceReviewsListParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceReviewsList>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceReviewsList>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceReviewsList>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceReviewsList<
  TData = Awaited<ReturnType<typeof apiCommerceReviewsList>>,
  TError = unknown,
>(
  params?: ApiCommerceReviewsListParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceReviewsList>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};

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

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

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

export const apiCommerceReviewsCreate = (
  reviewSerializerPublic: NonReadonly<ReviewSerializerPublic>,
  signal?: AbortSignal,
) => {
  return privateMutator<ReviewSerializerPublic>({
    url: `/api/commerce/reviews/`,
    method: "POST",
    headers: { "Content-Type": "application/json" },
    data: reviewSerializerPublic,
    signal,
  });
};

export const getApiCommerceReviewsCreateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiCommerceReviewsCreate>>,
    TError,
    { data: NonReadonly<ReviewSerializerPublic> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiCommerceReviewsCreate>>,
  TError,
  { data: NonReadonly<ReviewSerializerPublic> },
  TContext
> => {
  const mutationKey = ["apiCommerceReviewsCreate"];
  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 apiCommerceReviewsCreate>>,
    { data: NonReadonly<ReviewSerializerPublic> }
  > = (props) => {
    const { data } = props ?? {};

    return apiCommerceReviewsCreate(data);
  };

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

export type ApiCommerceReviewsCreateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceReviewsCreate>>
>;
export type ApiCommerceReviewsCreateMutationBody =
  NonReadonly<ReviewSerializerPublic>;
export type ApiCommerceReviewsCreateMutationError = unknown;

export const useApiCommerceReviewsCreate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiCommerceReviewsCreate>>,
      TError,
      { data: NonReadonly<ReviewSerializerPublic> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiCommerceReviewsCreate>>,
  TError,
  { data: NonReadonly<ReviewSerializerPublic> },
  TContext
> => {
  return useMutation(
    getApiCommerceReviewsCreateMutationOptions(options),
    queryClient,
  );
};
export const apiCommerceReviewsRetrieve = (
  id: number,
  signal?: AbortSignal,
) => {
  return privateMutator<ReviewSerializerPublic>({
    url: `/api/commerce/reviews/${id}/`,
    method: "GET",
    signal,
  });
};

export const getApiCommerceReviewsRetrieveQueryKey = (id: number) => {
  return [`/api/commerce/reviews/${id}/`] as const;
};

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

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

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

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

export type ApiCommerceReviewsRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceReviewsRetrieve>>
>;
export type ApiCommerceReviewsRetrieveQueryError = unknown;

export function useApiCommerceReviewsRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceReviewsRetrieve>>,
  TError = unknown,
>(
  id: number,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceReviewsRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceReviewsRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceReviewsRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceReviewsRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceReviewsRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceReviewsRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceReviewsRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceReviewsRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceReviewsRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceReviewsRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceReviewsRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};

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

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

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

export const apiCommerceReviewsUpdate = (
  id: number,
  reviewSerializerPublic: NonReadonly<ReviewSerializerPublic>,
  signal?: AbortSignal,
) => {
  return privateMutator<ReviewSerializerPublic>({
    url: `/api/commerce/reviews/${id}/`,
    method: "PUT",
    headers: { "Content-Type": "application/json" },
    data: reviewSerializerPublic,
    signal,
  });
};

export const getApiCommerceReviewsUpdateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiCommerceReviewsUpdate>>,
    TError,
    { id: number; data: NonReadonly<ReviewSerializerPublic> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiCommerceReviewsUpdate>>,
  TError,
  { id: number; data: NonReadonly<ReviewSerializerPublic> },
  TContext
> => {
  const mutationKey = ["apiCommerceReviewsUpdate"];
  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 apiCommerceReviewsUpdate>>,
    { id: number; data: NonReadonly<ReviewSerializerPublic> }
  > = (props) => {
    const { id, data } = props ?? {};

    return apiCommerceReviewsUpdate(id, data);
  };

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

export type ApiCommerceReviewsUpdateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceReviewsUpdate>>
>;
export type ApiCommerceReviewsUpdateMutationBody =
  NonReadonly<ReviewSerializerPublic>;
export type ApiCommerceReviewsUpdateMutationError = unknown;

export const useApiCommerceReviewsUpdate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiCommerceReviewsUpdate>>,
      TError,
      { id: number; data: NonReadonly<ReviewSerializerPublic> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiCommerceReviewsUpdate>>,
  TError,
  { id: number; data: NonReadonly<ReviewSerializerPublic> },
  TContext
> => {
  return useMutation(
    getApiCommerceReviewsUpdateMutationOptions(options),
    queryClient,
  );
};
export const apiCommerceReviewsPartialUpdate = (
  id: number,
  patchedReviewSerializerPublic: NonReadonly<PatchedReviewSerializerPublic>,
  signal?: AbortSignal,
) => {
  return privateMutator<ReviewSerializerPublic>({
    url: `/api/commerce/reviews/${id}/`,
    method: "PATCH",
    headers: { "Content-Type": "application/json" },
    data: patchedReviewSerializerPublic,
    signal,
  });
};

export const getApiCommerceReviewsPartialUpdateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiCommerceReviewsPartialUpdate>>,
    TError,
    { id: number; data: NonReadonly<PatchedReviewSerializerPublic> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiCommerceReviewsPartialUpdate>>,
  TError,
  { id: number; data: NonReadonly<PatchedReviewSerializerPublic> },
  TContext
> => {
  const mutationKey = ["apiCommerceReviewsPartialUpdate"];
  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 apiCommerceReviewsPartialUpdate>>,
    { id: number; data: NonReadonly<PatchedReviewSerializerPublic> }
  > = (props) => {
    const { id, data } = props ?? {};

    return apiCommerceReviewsPartialUpdate(id, data);
  };

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

export type ApiCommerceReviewsPartialUpdateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceReviewsPartialUpdate>>
>;
export type ApiCommerceReviewsPartialUpdateMutationBody =
  NonReadonly<PatchedReviewSerializerPublic>;
export type ApiCommerceReviewsPartialUpdateMutationError = unknown;

export const useApiCommerceReviewsPartialUpdate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiCommerceReviewsPartialUpdate>>,
      TError,
      { id: number; data: NonReadonly<PatchedReviewSerializerPublic> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiCommerceReviewsPartialUpdate>>,
  TError,
  { id: number; data: NonReadonly<PatchedReviewSerializerPublic> },
  TContext
> => {
  return useMutation(
    getApiCommerceReviewsPartialUpdateMutationOptions(options),
    queryClient,
  );
};
export const apiCommerceReviewsDestroy = (id: number, signal?: AbortSignal) => {
  return privateMutator<void>({
    url: `/api/commerce/reviews/${id}/`,
    method: "DELETE",
    signal,
  });
};

export const getApiCommerceReviewsDestroyMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiCommerceReviewsDestroy>>,
    TError,
    { id: number },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiCommerceReviewsDestroy>>,
  TError,
  { id: number },
  TContext
> => {
  const mutationKey = ["apiCommerceReviewsDestroy"];
  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 apiCommerceReviewsDestroy>>,
    { id: number }
  > = (props) => {
    const { id } = props ?? {};

    return apiCommerceReviewsDestroy(id);
  };

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

export type ApiCommerceReviewsDestroyMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceReviewsDestroy>>
>;

export type ApiCommerceReviewsDestroyMutationError = unknown;

export const useApiCommerceReviewsDestroy = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiCommerceReviewsDestroy>>,
      TError,
      { id: number },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiCommerceReviewsDestroy>>,
  TError,
  { id: number },
  TContext
> => {
  return useMutation(
    getApiCommerceReviewsDestroyMutationOptions(options),
    queryClient,
  );
};
export const apiCommerceReviewsProductRetrieve = (
  productId: number,
  signal?: AbortSignal,
) => {
  return privateMutator<ReviewSerializerPublic>({
    url: `/api/commerce/reviews/product/${productId}/`,
    method: "GET",
    signal,
  });
};

export const getApiCommerceReviewsProductRetrieveQueryKey = (
  productId: number,
) => {
  return [`/api/commerce/reviews/product/${productId}/`] as const;
};

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

  const queryKey =
    queryOptions?.queryKey ??
    getApiCommerceReviewsProductRetrieveQueryKey(productId);

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

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

export type ApiCommerceReviewsProductRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceReviewsProductRetrieve>>
>;
export type ApiCommerceReviewsProductRetrieveQueryError = unknown;

export function useApiCommerceReviewsProductRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceReviewsProductRetrieve>>,
  TError = unknown,
>(
  productId: number,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceReviewsProductRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceReviewsProductRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceReviewsProductRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceReviewsProductRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceReviewsProductRetrieve>>,
  TError = unknown,
>(
  productId: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceReviewsProductRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceReviewsProductRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceReviewsProductRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceReviewsProductRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceReviewsProductRetrieve>>,
  TError = unknown,
>(
  productId: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceReviewsProductRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};

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

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

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

/**
 * Add a product to the user's wishlist
 */
export const apiCommerceWishlistAddCreate = (
  wishlist: NonReadonly<Wishlist>,
  signal?: AbortSignal,
) => {
  return privateMutator<Wishlist>({
    url: `/api/commerce/wishlist/add/`,
    method: "POST",
    headers: { "Content-Type": "application/json" },
    data: wishlist,
    signal,
  });
};

export const getApiCommerceWishlistAddCreateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiCommerceWishlistAddCreate>>,
    TError,
    { data: NonReadonly<Wishlist> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiCommerceWishlistAddCreate>>,
  TError,
  { data: NonReadonly<Wishlist> },
  TContext
> => {
  const mutationKey = ["apiCommerceWishlistAddCreate"];
  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 apiCommerceWishlistAddCreate>>,
    { data: NonReadonly<Wishlist> }
  > = (props) => {
    const { data } = props ?? {};

    return apiCommerceWishlistAddCreate(data);
  };

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

export type ApiCommerceWishlistAddCreateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceWishlistAddCreate>>
>;
export type ApiCommerceWishlistAddCreateMutationBody = NonReadonly<Wishlist>;
export type ApiCommerceWishlistAddCreateMutationError = unknown;

export const useApiCommerceWishlistAddCreate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiCommerceWishlistAddCreate>>,
      TError,
      { data: NonReadonly<Wishlist> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiCommerceWishlistAddCreate>>,
  TError,
  { data: NonReadonly<Wishlist> },
  TContext
> => {
  return useMutation(
    getApiCommerceWishlistAddCreateMutationOptions(options),
    queryClient,
  );
};
/**
 * Check if a product is in user's wishlist
 */
export const apiCommerceWishlistCheckRetrieve = (
  productId: string,
  signal?: AbortSignal,
) => {
  return privateMutator<Wishlist>({
    url: `/api/commerce/wishlist/check/${productId}/`,
    method: "GET",
    signal,
  });
};

export const getApiCommerceWishlistCheckRetrieveQueryKey = (
  productId: string,
) => {
  return [`/api/commerce/wishlist/check/${productId}/`] as const;
};

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

  const queryKey =
    queryOptions?.queryKey ??
    getApiCommerceWishlistCheckRetrieveQueryKey(productId);

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

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

export type ApiCommerceWishlistCheckRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceWishlistCheckRetrieve>>
>;
export type ApiCommerceWishlistCheckRetrieveQueryError = unknown;

export function useApiCommerceWishlistCheckRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceWishlistCheckRetrieve>>,
  TError = unknown,
>(
  productId: string,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceWishlistCheckRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceWishlistCheckRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceWishlistCheckRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceWishlistCheckRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceWishlistCheckRetrieve>>,
  TError = unknown,
>(
  productId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceWishlistCheckRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceWishlistCheckRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceWishlistCheckRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceWishlistCheckRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceWishlistCheckRetrieve>>,
  TError = unknown,
>(
  productId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceWishlistCheckRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};

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

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

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

/**
 * Remove all products from the user's wishlist
 */
export const apiCommerceWishlistClearCreate = (
  wishlist: NonReadonly<Wishlist>,
  signal?: AbortSignal,
) => {
  return privateMutator<Wishlist>({
    url: `/api/commerce/wishlist/clear/`,
    method: "POST",
    headers: { "Content-Type": "application/json" },
    data: wishlist,
    signal,
  });
};

export const getApiCommerceWishlistClearCreateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiCommerceWishlistClearCreate>>,
    TError,
    { data: NonReadonly<Wishlist> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiCommerceWishlistClearCreate>>,
  TError,
  { data: NonReadonly<Wishlist> },
  TContext
> => {
  const mutationKey = ["apiCommerceWishlistClearCreate"];
  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 apiCommerceWishlistClearCreate>>,
    { data: NonReadonly<Wishlist> }
  > = (props) => {
    const { data } = props ?? {};

    return apiCommerceWishlistClearCreate(data);
  };

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

export type ApiCommerceWishlistClearCreateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceWishlistClearCreate>>
>;
export type ApiCommerceWishlistClearCreateMutationBody = NonReadonly<Wishlist>;
export type ApiCommerceWishlistClearCreateMutationError = unknown;

export const useApiCommerceWishlistClearCreate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiCommerceWishlistClearCreate>>,
      TError,
      { data: NonReadonly<Wishlist> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiCommerceWishlistClearCreate>>,
  TError,
  { data: NonReadonly<Wishlist> },
  TContext
> => {
  return useMutation(
    getApiCommerceWishlistClearCreateMutationOptions(options),
    queryClient,
  );
};
/**
 * Get the current user's wishlist
 */
export const apiCommerceWishlistCurrentRetrieve = (signal?: AbortSignal) => {
  return privateMutator<Wishlist>({
    url: `/api/commerce/wishlist/current/`,
    method: "GET",
    signal,
  });
};

export const getApiCommerceWishlistCurrentRetrieveQueryKey = () => {
  return [`/api/commerce/wishlist/current/`] as const;
};

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

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

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

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

export type ApiCommerceWishlistCurrentRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceWishlistCurrentRetrieve>>
>;
export type ApiCommerceWishlistCurrentRetrieveQueryError = unknown;

export function useApiCommerceWishlistCurrentRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceWishlistCurrentRetrieve>>,
  TError = unknown,
>(
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceWishlistCurrentRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceWishlistCurrentRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceWishlistCurrentRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceWishlistCurrentRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceWishlistCurrentRetrieve>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceWishlistCurrentRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiCommerceWishlistCurrentRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiCommerceWishlistCurrentRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiCommerceWishlistCurrentRetrieve<
  TData = Awaited<ReturnType<typeof apiCommerceWishlistCurrentRetrieve>>,
  TError = unknown,
>(
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiCommerceWishlistCurrentRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};

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

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

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

/**
 * Remove a product from the user's wishlist
 */
export const apiCommerceWishlistRemoveCreate = (
  wishlist: NonReadonly<Wishlist>,
  signal?: AbortSignal,
) => {
  return privateMutator<Wishlist>({
    url: `/api/commerce/wishlist/remove/`,
    method: "POST",
    headers: { "Content-Type": "application/json" },
    data: wishlist,
    signal,
  });
};

export const getApiCommerceWishlistRemoveCreateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiCommerceWishlistRemoveCreate>>,
    TError,
    { data: NonReadonly<Wishlist> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiCommerceWishlistRemoveCreate>>,
  TError,
  { data: NonReadonly<Wishlist> },
  TContext
> => {
  const mutationKey = ["apiCommerceWishlistRemoveCreate"];
  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 apiCommerceWishlistRemoveCreate>>,
    { data: NonReadonly<Wishlist> }
  > = (props) => {
    const { data } = props ?? {};

    return apiCommerceWishlistRemoveCreate(data);
  };

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

export type ApiCommerceWishlistRemoveCreateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiCommerceWishlistRemoveCreate>>
>;
export type ApiCommerceWishlistRemoveCreateMutationBody = NonReadonly<Wishlist>;
export type ApiCommerceWishlistRemoveCreateMutationError = unknown;

export const useApiCommerceWishlistRemoveCreate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiCommerceWishlistRemoveCreate>>,
      TError,
      { data: NonReadonly<Wishlist> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiCommerceWishlistRemoveCreate>>,
  TError,
  { data: NonReadonly<Wishlist> },
  TContext
> => {
  return useMutation(
    getApiCommerceWishlistRemoveCreateMutationOptions(options),
    queryClient,
  );
};
/**
 * OpenApi3 schema for this API. Format can be selected via content negotiation.

- YAML: application/vnd.oai.openapi
- JSON: application/vnd.oai.openapi+json
 */
export const apiSchemaRetrieve = (
  params?: ApiSchemaRetrieveParams,
  signal?: AbortSignal,
) => {
  return privateMutator<
    | ApiSchemaRetrieve200One
    | ApiSchemaRetrieve200Two
    | ApiSchemaRetrieve200Three
    | ApiSchemaRetrieve200Four
  >({ url: `/api/schema/`, method: "GET", params, signal });
};

export const getApiSchemaRetrieveQueryKey = (
  params?: ApiSchemaRetrieveParams,
) => {
  return [`/api/schema/`, ...(params ? [params] : [])] as const;
};

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

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

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

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

export type ApiSchemaRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiSchemaRetrieve>>
>;
export type ApiSchemaRetrieveQueryError = unknown;

export function useApiSchemaRetrieve<
  TData = Awaited<ReturnType<typeof apiSchemaRetrieve>>,
  TError = unknown,
>(
  params: undefined | ApiSchemaRetrieveParams,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiSchemaRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiSchemaRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiSchemaRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiSchemaRetrieve<
  TData = Awaited<ReturnType<typeof apiSchemaRetrieve>>,
  TError = unknown,
>(
  params?: ApiSchemaRetrieveParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiSchemaRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiSchemaRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiSchemaRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiSchemaRetrieve<
  TData = Awaited<ReturnType<typeof apiSchemaRetrieve>>,
  TError = unknown,
>(
  params?: ApiSchemaRetrieveParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiSchemaRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};

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

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

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

export const apiSocialMessagesCreate = (
  message: NonReadonly<Message>,
  signal?: AbortSignal,
) => {
  return privateMutator<Message>({
    url: `/api/social/messages/`,
    method: "POST",
    headers: { "Content-Type": "application/json" },
    data: message,
    signal,
  });
};

export const getApiSocialMessagesCreateMutationOptions = <
  TError = unknown,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof apiSocialMessagesCreate>>,
    TError,
    { data: NonReadonly<Message> },
    TContext
  >;
}): UseMutationOptions<
  Awaited<ReturnType<typeof apiSocialMessagesCreate>>,
  TError,
  { data: NonReadonly<Message> },
  TContext
> => {
  const mutationKey = ["apiSocialMessagesCreate"];
  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 apiSocialMessagesCreate>>,
    { data: NonReadonly<Message> }
  > = (props) => {
    const { data } = props ?? {};

    return apiSocialMessagesCreate(data);
  };

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

export type ApiSocialMessagesCreateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiSocialMessagesCreate>>
>;
export type ApiSocialMessagesCreateMutationBody = NonReadonly<Message>;
export type ApiSocialMessagesCreateMutationError = unknown;

export const useApiSocialMessagesCreate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiSocialMessagesCreate>>,
      TError,
      { data: NonReadonly<Message> },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiSocialMessagesCreate>>,
  TError,
  { data: NonReadonly<Message> },
  TContext
> => {
  return useMutation(
    getApiSocialMessagesCreateMutationOptions(options),
    queryClient,
  );
};
