import { FilledContentRelationshipField } from "../types/value/contentRelationship.cjs";
import { FilledLinkToMediaField } from "../types/value/linkToMedia.cjs";
import { FilledLinkToWebField, LinkField } from "../types/value/link.cjs";
import { PrismicDocument } from "../types/value/document.cjs";

//#region src/helpers/asLink.d.ts

/**
 * Resolves a link to a Prismic page to a URL.
 *
 * @typeParam ReturnType - Return type of your link resolver function. Useful if
 *   you prefer to return a complex object.
 *
 * @param linkToDocumentField - A page link field to resolve.
 *
 * @returns Resolved URL.
 *
 * @see Learn about route resolvers and link resolvers: {@link https://prismic.io/docs/routes}
 */
type LinkResolverFunction<ReturnType = string | null | undefined> = (linkToDocumentField: FilledContentRelationshipField) => ReturnType;
/**
 * Configuration that determines the output of `asLink()`.
 */
type AsLinkConfig<LinkResolverFunctionReturnType = string | null | undefined> = {
  /**
   * An optional link resolver function. Without it, you're expected to use
   * the `routes` option from the API.
   */
  linkResolver?: LinkResolverFunction<LinkResolverFunctionReturnType> | null;
};
/**
 * @deprecated Use object-style configuration instead.
 */
type AsLinkDeprecatedTupleConfig<LinkResolverFunctionReturnType = string | null | undefined> = [linkResolver?: LinkResolverFunction<LinkResolverFunctionReturnType> | null];
/**
 * The return type of `asLink()`.
 */
type AsLinkReturnType<LinkResolverFunctionReturnType = string | null | undefined, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined> = Field extends FilledLinkToWebField | FilledLinkToMediaField | FilledContentRelationshipField | PrismicDocument ? LinkResolverFunctionReturnType | string | null : null;
declare const asLink: {
  /**
   * Converts any type of link field or Prismic page to a URL.
   *
   * @example
   *
   * ```ts
   * const url = asLink(document.data.link)
   * // => "/blog/my-post"
   * ```
   *
   * @typeParam LinkResolverFunctionReturnType - Link resolver function return
   *   type.
   * @typeParam Field - Link field or Prismic page to resolve to a URL.
   *
   * @param linkFieldOrDocument - Any kind of link field or a page to resolve.
   * @param config - Configuration that determines the output of `asLink()`.
   *
   * @returns Resolved URL, or `null` if the link field or page is empty.
   *
   * @see Learn about route resolvers and link resolvers: {@link https://prismic.io/docs/routes}
   */
  <LinkResolverFunctionReturnType = string | null | undefined, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined>(linkFieldOrDocument: Field, config?: AsLinkConfig<LinkResolverFunctionReturnType>): AsLinkReturnType<LinkResolverFunctionReturnType, Field>;
  /**
   * Converts any type of link field or Prismic page to a URL.
   *
   * @deprecated Use object-style configuration instead.
   *
   * @typeParam LinkResolverFunctionReturnType - Link resolver function return
   *   type.
   * @typeParam Field - Link field or Prismic page to resolve to a URL.
   *
   * @param linkFieldOrDocument - Any kind of link field or a page to resolve.
   * @param linkResolver - An optional link resolver function. Without it,
   *   you're expected to use the `routes` option from the API.
   *
   * @returns Resolved URL, or `null` if the link field or page is empty.
   *
   * @see Learn about route resolvers and link resolvers: {@link https://prismic.io/docs/routes}
   */
  <LinkResolverFunctionReturnType = string | null | undefined, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined>(linkFieldOrDocument: Field, ...config: AsLinkDeprecatedTupleConfig<LinkResolverFunctionReturnType>): AsLinkReturnType<LinkResolverFunctionReturnType, Field>;
};
//#endregion
export { AsLinkReturnType, LinkResolverFunction, asLink };
//# sourceMappingURL=asLink.d.cts.map