import {
  ordersQueryKeys
} from "./chunk-TAKEQAZZ.js";
import {
  queryClient
} from "./chunk-RHKRREUU.js";
import {
  queryKeysFactory
} from "./chunk-ZA2KFUFR.js";
import {
  sdk
} from "./chunk-ZBWL72TB.js";

// src/hooks/api/notification.tsx
import { useQuery } from "@tanstack/react-query";
var NOTIFICATION_QUERY_KEY = "notification";
var notificationQueryKeys = queryKeysFactory(NOTIFICATION_QUERY_KEY);
var useNotifications = (query, options) => {
  const { data, ...rest } = useQuery({
    queryFn: () => sdk.admin.notifications.query({ ...query }),
    queryKey: notificationQueryKeys.list(query),
    ...options
  });
  return { ...data, ...rest };
};

// src/hooks/api/product-variants.tsx
import { useQuery as useQuery2 } from "@tanstack/react-query";
var PRODUCT_VARIANT_QUERY_KEY = "product_variant";
var productVariantQueryKeys = queryKeysFactory(
  PRODUCT_VARIANT_QUERY_KEY
);
var useVariants = (query, options) => {
  const { data, ...rest } = useQuery2({
    queryFn: () => sdk.admin.productVariants.query({ ...query }),
    queryKey: productVariantQueryKeys.list(query),
    ...options
  });
  return { ...data, ...rest };
};

// src/hooks/api/refund-reasons.tsx
import {
  useMutation,
  useQuery as useQuery3
} from "@tanstack/react-query";
var REFUND_REASONS_QUERY_KEY = "refund_reasons";
var refundReasonsQueryKeys = queryKeysFactory(
  REFUND_REASONS_QUERY_KEY
);
var useRefundReasons = (query, options) => {
  const { data, ...rest } = useQuery3({
    queryFn: () => sdk.admin.refundReasons.query({ ...query }),
    queryKey: refundReasonsQueryKeys.list(query),
    ...options
  });
  return { ...data, ...rest };
};
var useRefundReason = (id, query, options) => {
  const { data, ...rest } = useQuery3({
    queryFn: () => sdk.admin.refundReasons.$id.query({ $id: id, ...query }),
    queryKey: refundReasonsQueryKeys.detail(id),
    ...options
  });
  return { ...data, ...rest };
};
var useCreateRefundReason = (options) => {
  return useMutation({
    mutationFn: (payload) => sdk.admin.refundReasons.mutate(payload),
    onSuccess: (data, variables, context) => {
      queryClient.invalidateQueries({
        queryKey: refundReasonsQueryKeys.lists()
      });
      options?.onSuccess?.(data, variables, context);
    },
    ...options
  });
};
var useUpdateRefundReason = (id, options) => {
  return useMutation({
    mutationFn: (payload) => sdk.admin.refundReasons.$id.mutate({ $id: id, ...payload }),
    onSuccess: (data, variables, context) => {
      queryClient.invalidateQueries({
        queryKey: refundReasonsQueryKeys.lists()
      });
      queryClient.invalidateQueries({
        queryKey: refundReasonsQueryKeys.detail(id)
      });
      options?.onSuccess?.(data, variables, context);
    },
    ...options
  });
};
var useDeleteRefundReasonLazy = (options) => {
  return useMutation({
    mutationFn: (id) => sdk.admin.refundReasons.$id.delete({ $id: id }),
    onSuccess: (data, variables, context) => {
      queryClient.invalidateQueries({
        queryKey: refundReasonsQueryKeys.lists()
      });
      queryClient.invalidateQueries({
        queryKey: refundReasonsQueryKeys.details()
      });
      options?.onSuccess?.(data, variables, context);
    },
    ...options
  });
};

// src/hooks/api/subscription-plans.tsx
import {
  useQuery as useQuery4
} from "@tanstack/react-query";
var SUBSCRIPTION_PLANS_QUERY_KEY = "subscription_plans";
var subscriptionPlansQueryKeys = queryKeysFactory(
  SUBSCRIPTION_PLANS_QUERY_KEY
);
var useSubscriptionPlans = (query, options) => {
  const { data, ...rest } = useQuery4({
    queryFn: () => sdk.admin.subscriptionPlans.query({ ...query }),
    queryKey: subscriptionPlansQueryKeys.list(query),
    ...options
  });
  return { ...data, ...rest };
};

// src/hooks/api/shipping-option-types.tsx
import {
  useMutation as useMutation2,
  useQuery as useQuery5
} from "@tanstack/react-query";
var SHIPPING_OPTION_TYPES_QUERY_KEY = "shipping_option_types";
var shippingOptionTypesQueryKeys = queryKeysFactory(
  SHIPPING_OPTION_TYPES_QUERY_KEY
);
var useShippingOptionType = (id, query, options) => {
  const { data, ...rest } = useQuery5({
    queryFn: () => sdk.admin.shippingOptionTypes.$id.query({ $id: id, ...query }),
    queryKey: shippingOptionTypesQueryKeys.detail(id),
    ...options
  });
  return { ...data, ...rest };
};
var useShippingOptionTypes = (query, options) => {
  const { data, ...rest } = useQuery5({
    queryFn: () => sdk.admin.shippingOptionTypes.query({ ...query }),
    queryKey: shippingOptionTypesQueryKeys.list(query),
    ...options
  });
  return { ...data, ...rest };
};
var useCreateShippingOptionType = (options) => {
  return useMutation2({
    mutationFn: (payload) => sdk.admin.shippingOptionTypes.mutate(payload),
    onSuccess: (data, variables, context) => {
      queryClient.invalidateQueries({
        queryKey: shippingOptionTypesQueryKeys.lists()
      });
      options?.onSuccess?.(data, variables, context);
    },
    ...options
  });
};
var useUpdateShippingOptionType = (id, options) => {
  return useMutation2({
    mutationFn: (payload) => sdk.admin.shippingOptionTypes.$id.mutate({ $id: id, ...payload }),
    onSuccess: (data, variables, context) => {
      queryClient.invalidateQueries({
        queryKey: shippingOptionTypesQueryKeys.detail(id)
      });
      queryClient.invalidateQueries({
        queryKey: shippingOptionTypesQueryKeys.lists()
      });
      options?.onSuccess?.(data, variables, context);
    },
    ...options
  });
};
var useDeleteShippingOptionType = (id, options) => {
  return useMutation2({
    mutationFn: () => sdk.admin.shippingOptionTypes.$id.delete({ $id: id }),
    onSuccess: (data, variables, context) => {
      queryClient.invalidateQueries({
        queryKey: shippingOptionTypesQueryKeys.detail(id)
      });
      queryClient.invalidateQueries({
        queryKey: shippingOptionTypesQueryKeys.lists()
      });
      options?.onSuccess?.(data, variables, context);
    },
    ...options
  });
};

// src/hooks/api/tags.tsx
import {
  useMutation as useMutation3,
  useQuery as useQuery6
} from "@tanstack/react-query";
var TAGS_QUERY_KEY = "tags";
var productTagsQueryKeys = queryKeysFactory(TAGS_QUERY_KEY);
var useProductTag = (id, query, options) => {
  const { data, ...rest } = useQuery6({
    queryKey: productTagsQueryKeys.detail(id, query),
    queryFn: () => sdk.admin.productTags.$id.query({ $id: id, ...query }),
    ...options
  });
  return { ...data, ...rest };
};
var useProductTags = (query, options) => {
  const { data, ...rest } = useQuery6({
    queryKey: productTagsQueryKeys.list(query),
    queryFn: () => sdk.admin.productTags.query({ ...query }),
    ...options
  });
  return { ...data, ...rest };
};
var useCreateProductTag = (options) => {
  return useMutation3({
    mutationFn: (payload) => sdk.admin.productTags.mutate(payload),
    onSuccess: (data, variables, context) => {
      queryClient.invalidateQueries({
        queryKey: productTagsQueryKeys.lists()
      });
      options?.onSuccess?.(data, variables, context);
    },
    ...options
  });
};
var useUpdateProductTag = (id, options) => {
  return useMutation3({
    mutationFn: (payload) => sdk.admin.productTags.$id.mutate({ $id: id, ...payload }),
    onSuccess: (data, variables, context) => {
      queryClient.invalidateQueries({
        queryKey: productTagsQueryKeys.lists()
      });
      queryClient.invalidateQueries({
        queryKey: productTagsQueryKeys.detail(id)
      });
      options?.onSuccess?.(data, variables, context);
    },
    ...options
  });
};
var useDeleteProductTag = (id, options) => {
  return useMutation3({
    mutationFn: () => sdk.admin.productTags.$id.delete({ $id: id }),
    onSuccess: (data, variables, context) => {
      queryClient.invalidateQueries({
        queryKey: productTagsQueryKeys.lists()
      });
      queryClient.invalidateQueries({
        queryKey: productTagsQueryKeys.detail(id)
      });
      options?.onSuccess?.(data, variables, context);
    },
    ...options
  });
};

// src/hooks/api/fulfillment.tsx
import { useMutation as useMutation4 } from "@tanstack/react-query";
var FULFILLMENTS_QUERY_KEY = "fulfillments";
var fulfillmentsQueryKeys = queryKeysFactory(FULFILLMENTS_QUERY_KEY);

// src/hooks/api/payment-collections.tsx
import { useMutation as useMutation5 } from "@tanstack/react-query";
var PAYMENT_COLLECTION_QUERY_KEY = "payment-collection";
var paymentCollectionQueryKeys = queryKeysFactory(
  PAYMENT_COLLECTION_QUERY_KEY
);
var useMarkPaymentCollectionAsPaid = (orderId, paymentCollectionId, options) => {
  return useMutation5({
    mutationFn: (payload) => sdk.admin.paymentCollections.$id.markAsPaid.mutate({
      $id: paymentCollectionId,
      ...payload
    }),
    onSuccess: (data, variables, context) => {
      queryClient.invalidateQueries({
        queryKey: ordersQueryKeys.details()
      });
      queryClient.invalidateQueries({
        queryKey: ordersQueryKeys.preview(orderId)
      });
      queryClient.invalidateQueries({
        queryKey: paymentCollectionQueryKeys.all
      });
      options?.onSuccess?.(data, variables, context);
    },
    ...options
  });
};

// src/hooks/api/payments.tsx
import {
  useMutation as useMutation6,
  useQuery as useQuery7
} from "@tanstack/react-query";
var PAYMENT_QUERY_KEY = "payment";
var paymentQueryKeys = queryKeysFactory(PAYMENT_QUERY_KEY);
var PAYMENT_PROVIDERS_QUERY_KEY = "payment_providers";
var paymentProvidersQueryKeys = queryKeysFactory(
  PAYMENT_PROVIDERS_QUERY_KEY
);
var useCapturePayment = (orderId, paymentId, options) => {
  return useMutation6({
    mutationFn: (payload) => sdk.admin.payments.$id.capture.mutate({ $id: paymentId, ...payload }),
    onSuccess: (data, variables, context) => {
      queryClient.invalidateQueries({
        queryKey: ordersQueryKeys.details()
      });
      queryClient.invalidateQueries({
        queryKey: ordersQueryKeys.preview(orderId)
      });
      options?.onSuccess?.(data, variables, context);
    },
    ...options
  });
};
var useRefundPayment = (orderId, paymentId, options) => {
  return useMutation6({
    mutationFn: (payload) => sdk.admin.payments.$id.refund.mutate({ $id: paymentId, ...payload }),
    onSuccess: (data, variables, context) => {
      queryClient.invalidateQueries({
        queryKey: ordersQueryKeys.details()
      });
      queryClient.invalidateQueries({
        queryKey: ordersQueryKeys.preview(orderId)
      });
      options?.onSuccess?.(data, variables, context);
    },
    ...options
  });
};

export {
  notificationQueryKeys,
  useNotifications,
  useMarkPaymentCollectionAsPaid,
  useCapturePayment,
  useRefundPayment,
  productVariantQueryKeys,
  useVariants,
  refundReasonsQueryKeys,
  useRefundReasons,
  useRefundReason,
  useCreateRefundReason,
  useUpdateRefundReason,
  useDeleteRefundReasonLazy,
  subscriptionPlansQueryKeys,
  useSubscriptionPlans,
  shippingOptionTypesQueryKeys,
  useShippingOptionType,
  useShippingOptionTypes,
  useCreateShippingOptionType,
  useUpdateShippingOptionType,
  useDeleteShippingOptionType,
  productTagsQueryKeys,
  useProductTag,
  useProductTags,
  useCreateProductTag,
  useUpdateProductTag,
  useDeleteProductTag
};
