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

import * as z from "zod/v3";
import { remap as remap$ } from "../../lib/primitives.js";
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";
import { Affordance, Affordance$inboundSchema } from "./affordance.js";

/**
 * Available actions for this document. Actions vary based on document state - upload actions during initial upload, remediation actions after processing.
 */
export type BulkJobItemActions = {
  /**
   * Azure Blob Store presigned URL to upload the document file (valid for ~8 hours)
   */
  uploadDocument?: string | undefined;
  /**
   * Affordances (aka 'actions') describe the available operations on a resource, including CRUD and RPC-like operations. It details the
   *
   * @remarks
   * expected input payload, http method, query parameters, and the resulting output.
   *
   * Affordances enable clients to dynamically adapt to the API's current state and available actions. Instead of
   * hardcoding all possible endpoints and their associated logic, a client can inspect the affordances within a
   * resource's representation to discover what actions are possible and how to perform them.
   */
  updateMetadata?: Affordance | null | undefined;
};

/** @internal */
export const BulkJobItemActions$inboundSchema: z.ZodType<
  BulkJobItemActions,
  z.ZodTypeDef,
  unknown
> = z.object({
  upload_document: types.optional(types.string()),
  update_metadata: z.nullable(Affordance$inboundSchema).optional(),
}).transform((v) => {
  return remap$(v, {
    "upload_document": "uploadDocument",
    "update_metadata": "updateMetadata",
  });
});

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