/**
 * 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 {
  ApiZasilkovnaShipmentsListParams,
  PaginatedZasilkovnaShipmentList,
  TrackingURL,
  ZasilkovnaPacket,
  ZasilkovnaShipment,
} from "../models";

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

/**
 * #TODO: Popis endpointu
 * @summary Packet
 */
export const apiZasilkovnaPacketsRetrieve = (
  id: number,
  signal?: AbortSignal,
) => {
  return privateMutator<ZasilkovnaPacket>({
    url: `/api/zasilkovna/packets/${id}/`,
    method: "GET",
    signal,
  });
};

export const getApiZasilkovnaPacketsRetrieveQueryKey = (id: number) => {
  return [`/api/zasilkovna/packets/${id}/`] as const;
};

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

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

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

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

export type ApiZasilkovnaPacketsRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiZasilkovnaPacketsRetrieve>>
>;
export type ApiZasilkovnaPacketsRetrieveQueryError = unknown;

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

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

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

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

/**
 * Cancels the packet through the Packeta API and updates its state to CANCELED. No request body is required.
 * @summary Cancel packet
 */
export const apiZasilkovnaPacketsCancelPartialUpdate = (
  id: number,
  signal?: AbortSignal,
) => {
  return privateMutator<ZasilkovnaPacket>({
    url: `/api/zasilkovna/packets/${id}/cancel/`,
    method: "PATCH",
    signal,
  });
};

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

    return apiZasilkovnaPacketsCancelPartialUpdate(id);
  };

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

export type ApiZasilkovnaPacketsCancelPartialUpdateMutationResult = NonNullable<
  Awaited<ReturnType<typeof apiZasilkovnaPacketsCancelPartialUpdate>>
>;

export type ApiZasilkovnaPacketsCancelPartialUpdateMutationError = unknown;

/**
 * @summary Cancel packet
 */
export const useApiZasilkovnaPacketsCancelPartialUpdate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<ReturnType<typeof apiZasilkovnaPacketsCancelPartialUpdate>>,
      TError,
      { id: number },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiZasilkovnaPacketsCancelPartialUpdate>>,
  TError,
  { id: number },
  TContext
> => {
  return useMutation(
    getApiZasilkovnaPacketsCancelPartialUpdateMutationOptions(options),
    queryClient,
  );
};
/**
 * Objedná přepravu přes API Packety,podle existujicího objektu, kde je od uživatele uložený id od místa poslání.
 * @summary Order shipping
 */
export const apiZasilkovnaPacketsOrderShippingPartialUpdate = (
  id: number,
  signal?: AbortSignal,
) => {
  return privateMutator<ZasilkovnaPacket>({
    url: `/api/zasilkovna/packets/${id}/order-shipping/`,
    method: "PATCH",
    signal,
  });
};

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

      return apiZasilkovnaPacketsOrderShippingPartialUpdate(id);
    };

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

export type ApiZasilkovnaPacketsOrderShippingPartialUpdateMutationResult =
  NonNullable<
    Awaited<ReturnType<typeof apiZasilkovnaPacketsOrderShippingPartialUpdate>>
  >;

export type ApiZasilkovnaPacketsOrderShippingPartialUpdateMutationError =
  unknown;

/**
 * @summary Order shipping
 */
export const useApiZasilkovnaPacketsOrderShippingPartialUpdate = <
  TError = unknown,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<
        ReturnType<typeof apiZasilkovnaPacketsOrderShippingPartialUpdate>
      >,
      TError,
      { id: number },
      TContext
    >;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof apiZasilkovnaPacketsOrderShippingPartialUpdate>>,
  TError,
  { id: number },
  TContext
> => {
  return useMutation(
    getApiZasilkovnaPacketsOrderShippingPartialUpdateMutationOptions(options),
    queryClient,
  );
};
/**
 * Returns HTML widget for user to select pickup point. No request body is required.
 * @summary Get widget for user, to select pickup point.
 */
export const apiZasilkovnaPacketsPickupPointWidgetRetrieve = (
  id: number,
  signal?: AbortSignal,
) => {
  return privateMutator<TrackingURL>({
    url: `/api/zasilkovna/packets/${id}/pickup-point-widget/`,
    method: "GET",
    signal,
  });
};

export const getApiZasilkovnaPacketsPickupPointWidgetRetrieveQueryKey = (
  id: number,
) => {
  return [`/api/zasilkovna/packets/${id}/pickup-point-widget/`] as const;
};

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

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

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

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

export type ApiZasilkovnaPacketsPickupPointWidgetRetrieveQueryResult =
  NonNullable<
    Awaited<ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>>
  >;
export type ApiZasilkovnaPacketsPickupPointWidgetRetrieveQueryError = unknown;

export function useApiZasilkovnaPacketsPickupPointWidgetRetrieve<
  TData = Awaited<
    ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
  >,
  TError = unknown,
>(
  id: number,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
        >,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<
            ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
          >,
          TError,
          Awaited<
            ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
          >
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiZasilkovnaPacketsPickupPointWidgetRetrieve<
  TData = Awaited<
    ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
  >,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
        >,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<
            ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
          >,
          TError,
          Awaited<
            ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
          >
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiZasilkovnaPacketsPickupPointWidgetRetrieve<
  TData = Awaited<
    ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
  >,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<typeof apiZasilkovnaPacketsPickupPointWidgetRetrieve>
        >,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary Get widget for user, to select pickup point.
 */

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

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

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

/**
 * Returns the public Zásilkovna tracking URL derived from the packet's barcode.
 * @summary Get public tracking URL
 */
export const apiZasilkovnaPacketsTrackingUrlRetrieve = (
  id: number,
  signal?: AbortSignal,
) => {
  return privateMutator<TrackingURL>({
    url: `/api/zasilkovna/packets/${id}/tracking-url/`,
    method: "GET",
    signal,
  });
};

export const getApiZasilkovnaPacketsTrackingUrlRetrieveQueryKey = (
  id: number,
) => {
  return [`/api/zasilkovna/packets/${id}/tracking-url/`] as const;
};

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

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

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

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

export type ApiZasilkovnaPacketsTrackingUrlRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>
>;
export type ApiZasilkovnaPacketsTrackingUrlRetrieveQueryError = unknown;

export function useApiZasilkovnaPacketsTrackingUrlRetrieve<
  TData = Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>,
  TError = unknown,
>(
  id: number,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiZasilkovnaPacketsTrackingUrlRetrieve<
  TData = Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiZasilkovnaPacketsTrackingUrlRetrieve<
  TData = Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiZasilkovnaPacketsTrackingUrlRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary Get public tracking URL
 */

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

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

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

/**
 * Returns a paginated list of Packeta (Zásilkovna) shipments.
 * @summary Hromadný shipment
 */
export const apiZasilkovnaShipmentsList = (
  params?: ApiZasilkovnaShipmentsListParams,
  signal?: AbortSignal,
) => {
  return privateMutator<PaginatedZasilkovnaShipmentList>({
    url: `/api/zasilkovna/shipments/`,
    method: "GET",
    params,
    signal,
  });
};

export const getApiZasilkovnaShipmentsListQueryKey = (
  params?: ApiZasilkovnaShipmentsListParams,
) => {
  return [`/api/zasilkovna/shipments/`, ...(params ? [params] : [])] as const;
};

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

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

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

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

export type ApiZasilkovnaShipmentsListQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>
>;
export type ApiZasilkovnaShipmentsListQueryError = unknown;

export function useApiZasilkovnaShipmentsList<
  TData = Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
  TError = unknown,
>(
  params: undefined | ApiZasilkovnaShipmentsListParams,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
          TError,
          Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiZasilkovnaShipmentsList<
  TData = Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
  TError = unknown,
>(
  params?: ApiZasilkovnaShipmentsListParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
          TError,
          Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiZasilkovnaShipmentsList<
  TData = Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
  TError = unknown,
>(
  params?: ApiZasilkovnaShipmentsListParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiZasilkovnaShipmentsList>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary Hromadný shipment
 */

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

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

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

/**
 * Returns detail for a single shipment.
 * @summary Detail hromadné zásilky
 */
export const apiZasilkovnaShipmentsRetrieve = (
  id: number,
  signal?: AbortSignal,
) => {
  return privateMutator<ZasilkovnaShipment>({
    url: `/api/zasilkovna/shipments/${id}/`,
    method: "GET",
    signal,
  });
};

export const getApiZasilkovnaShipmentsRetrieveQueryKey = (id: number) => {
  return [`/api/zasilkovna/shipments/${id}/`] as const;
};

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

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

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

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

export type ApiZasilkovnaShipmentsRetrieveQueryResult = NonNullable<
  Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>
>;
export type ApiZasilkovnaShipmentsRetrieveQueryError = unknown;

export function useApiZasilkovnaShipmentsRetrieve<
  TData = Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>,
  TError = unknown,
>(
  id: number,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiZasilkovnaShipmentsRetrieve<
  TData = Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>,
          TError,
          Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>
        >,
        "initialData"
      >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useApiZasilkovnaShipmentsRetrieve<
  TData = Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>,
  TError = unknown,
>(
  id: number,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<ReturnType<typeof apiZasilkovnaShipmentsRetrieve>>,
        TError,
        TData
      >
    >;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary Detail hromadné zásilky
 */

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

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

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