import { useQuery } from "@tanstack/react-query";
import { getCustomTagsSDK } from "services";
import { FAN_TAG_COUNT_LIMIT } from "@komi-app/fans-sdk";

export function useIsCustomTagsLimitCrossed() {
    const { isLoading, data } = useQuery<number>({
      queryKey: ["CustomTagsSDK-uniqueCount"],
      queryFn: () => getCustomTagsSDK().uniqueCount(),
    });
    return !isLoading && typeof data === 'number' && data > FAN_TAG_COUNT_LIMIT;
  }

  export function useTagsQuery() {
    return  useQuery({
      queryKey: ["CustomTagsSDK-getTags"],
      queryFn: () => getCustomTagsSDK().getTags({}),
    });
  }