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

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

export type GetWorkflowInstanceRequest = {
  /**
   * The unique identifier of the account.
   */
  accountId: string;
  /**
   * The unique identifier of the workflow.
   */
  workflowId: string;
  /**
   * Unique identifier for the workflow instance
   */
  instanceId: string;
};

/** @internal */
export const GetWorkflowInstanceRequest$inboundSchema: z.ZodType<
  GetWorkflowInstanceRequest,
  z.ZodTypeDef,
  unknown
> = z.object({
  accountId: z.string(),
  workflowId: z.string(),
  instanceId: z.string(),
});

/** @internal */
export type GetWorkflowInstanceRequest$Outbound = {
  accountId: string;
  workflowId: string;
  instanceId: string;
};

/** @internal */
export const GetWorkflowInstanceRequest$outboundSchema: z.ZodType<
  GetWorkflowInstanceRequest$Outbound,
  z.ZodTypeDef,
  GetWorkflowInstanceRequest
> = z.object({
  accountId: z.string(),
  workflowId: z.string(),
  instanceId: z.string(),
});

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace GetWorkflowInstanceRequest$ {
  /** @deprecated use `GetWorkflowInstanceRequest$inboundSchema` instead. */
  export const inboundSchema = GetWorkflowInstanceRequest$inboundSchema;
  /** @deprecated use `GetWorkflowInstanceRequest$outboundSchema` instead. */
  export const outboundSchema = GetWorkflowInstanceRequest$outboundSchema;
  /** @deprecated use `GetWorkflowInstanceRequest$Outbound` instead. */
  export type Outbound = GetWorkflowInstanceRequest$Outbound;
}

export function getWorkflowInstanceRequestToJSON(
  getWorkflowInstanceRequest: GetWorkflowInstanceRequest,
): string {
  return JSON.stringify(
    GetWorkflowInstanceRequest$outboundSchema.parse(getWorkflowInstanceRequest),
  );
}

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