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

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

export type WorkflowBasicDefinition = {
  id: string;
  /**
   * The name of the workflow
   */
  name: string;
  /**
   * The display name of the workflow
   */
  displayName: string;
  /**
   * A description of the workflow
   */
  description?: string | null | undefined;
  metadata?: WorkflowMetadata | undefined;
  /**
   * Whether the workflow is archived
   */
  archived: boolean;
};

/** @internal */
export const WorkflowBasicDefinition$inboundSchema: z.ZodType<
  WorkflowBasicDefinition,
  unknown
> = z.object({
  id: z.string(),
  name: z.string(),
  display_name: z.string(),
  description: z.nullable(z.string()).optional(),
  metadata: WorkflowMetadata$inboundSchema.optional(),
  archived: z.boolean(),
}).transform((v) => {
  return remap$(v, {
    "display_name": "displayName",
  });
});

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