/*
 * 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";
import {
  WorkspaceEnvelopeSummary,
  WorkspaceEnvelopeSummary$inboundSchema,
} from "./workspaceenvelopesummary.js";

export type GetWorkspaceEnvelopesResponse = {
  /**
   * The summary list of envelopes associated with the workspace
   */
  envelopes: Array<WorkspaceEnvelopeSummary> | null;
};

/** @internal */
export const GetWorkspaceEnvelopesResponse$inboundSchema: z.ZodType<
  GetWorkspaceEnvelopesResponse,
  z.ZodTypeDef,
  unknown
> = z.object({
  envelopes: types.nullable(z.array(WorkspaceEnvelopeSummary$inboundSchema)),
});

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