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

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

export type WorkflowMetadata = {
  /**
   * Namespace for shared workflows, None if user-owned
   */
  sharedNamespace?: string | null | undefined;
};

/** @internal */
export const WorkflowMetadata$inboundSchema: z.ZodType<
  WorkflowMetadata,
  unknown
> = z.object({
  shared_namespace: z.nullable(z.string()).optional(),
}).transform((v) => {
  return remap$(v, {
    "shared_namespace": "sharedNamespace",
  });
});

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