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

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

export type JSONPatchRemove = {
  /**
   * A JSON Pointer (RFC 6901) identifying the target location within the document. Can be a string path (e.g., '/foo/bar'), '/', '', or an empty list [] for root-level operations.
   */
  path: string;
  /**
   * The value to use for the operation
   */
  value: any;
  /**
   * Remove operation
   */
  op: "remove";
};

/** @internal */
export const JSONPatchRemove$inboundSchema: z.ZodType<
  JSONPatchRemove,
  unknown
> = z.object({
  path: z.string(),
  value: z.any(),
  op: z.literal("remove"),
});

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