/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import * as z from "zod/v3";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import * as types from "../../types/primitives.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

/**
 * A URL that references a specific page in the pagination process. This is typically used for navigation
 *
 * @remarks
 * between paginated results.
 */
export type PageLink = {
  /**
   * The URL for the referenced page.
   */
  href: string;
};

/** @internal */
export const PageLink$inboundSchema: z.ZodType<
  PageLink,
  z.ZodTypeDef,
  unknown
> = z.object({
  href: types.string(),
});

export function pageLinkFromJSON(
  jsonString: string,
): SafeParseResult<PageLink, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => PageLink$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'PageLink' from JSON`,
  );
}
