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

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 { WorkflowType, WorkflowType$inboundSchema } from "./workflowtype.js";

export type WorkflowWithWorkerStatus = {
  /**
   * Unique identifier of the workflow
   */
  id: string;
  /**
   * Name of the workflow
   */
  name: string;
  /**
   * Display name of the workflow
   */
  displayName: string;
  type: WorkflowType;
  /**
   * Description of the workflow
   */
  description?: string | null | undefined;
  /**
   * Customer ID of the workflow
   */
  customerId: string;
  /**
   * Workspace ID of the workflow
   */
  workspaceId: string;
  /**
   * Reserved namespace for shared workflows (e.g., 'shared:my-shared-workflow')
   */
  sharedNamespace?: string | null | undefined;
  /**
   * Whether the workflow is available in chat assistant
   */
  availableInChatAssistant: boolean;
  /**
   * Whether the workflow is technical (e.g. SDK-managed)
   */
  isTechnical: boolean;
  /**
   * Whether the workflow must run associated to a user's identity
   */
  onBehalfOf: boolean;
  /**
   * Whether the workflow is archived
   */
  archived: boolean;
  /**
   * Whether the workflow is active
   */
  active: boolean;
};

/** @internal */
export const WorkflowWithWorkerStatus$inboundSchema: z.ZodType<
  WorkflowWithWorkerStatus,
  unknown
> = z.object({
  id: z.string(),
  name: z.string(),
  display_name: z.string(),
  type: WorkflowType$inboundSchema,
  description: z.nullable(z.string()).optional(),
  customer_id: z.string(),
  workspace_id: z.string(),
  shared_namespace: z.nullable(z.string()).optional(),
  available_in_chat_assistant: z.boolean().default(false),
  is_technical: z.boolean().default(false),
  on_behalf_of: z.boolean().default(false),
  archived: z.boolean().default(false),
  active: z.boolean(),
}).transform((v) => {
  return remap$(v, {
    "display_name": "displayName",
    "customer_id": "customerId",
    "workspace_id": "workspaceId",
    "shared_namespace": "sharedNamespace",
    "available_in_chat_assistant": "availableInChatAssistant",
    "is_technical": "isTechnical",
    "on_behalf_of": "onBehalfOf",
  });
});

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