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

import * as z from "zod";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import {
  Thread,
  Thread$inboundSchema,
  Thread$Outbound,
  Thread$outboundSchema,
} from "../components/thread.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type GetV2ThreadsThreadIdRequest = {
  threadId: string;
};

/**
 * Success
 */
export type GetV2ThreadsThreadIdResponse = {
  data: Thread;
};

/** @internal */
export const GetV2ThreadsThreadIdRequest$inboundSchema: z.ZodType<
  GetV2ThreadsThreadIdRequest,
  z.ZodTypeDef,
  unknown
> = z.object({
  thread_id: z.string(),
}).transform((v) => {
  return remap$(v, {
    "thread_id": "threadId",
  });
});

/** @internal */
export type GetV2ThreadsThreadIdRequest$Outbound = {
  thread_id: string;
};

/** @internal */
export const GetV2ThreadsThreadIdRequest$outboundSchema: z.ZodType<
  GetV2ThreadsThreadIdRequest$Outbound,
  z.ZodTypeDef,
  GetV2ThreadsThreadIdRequest
> = z.object({
  threadId: z.string(),
}).transform((v) => {
  return remap$(v, {
    threadId: "thread_id",
  });
});

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

export function getV2ThreadsThreadIdRequestToJSON(
  getV2ThreadsThreadIdRequest: GetV2ThreadsThreadIdRequest,
): string {
  return JSON.stringify(
    GetV2ThreadsThreadIdRequest$outboundSchema.parse(
      getV2ThreadsThreadIdRequest,
    ),
  );
}

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

/** @internal */
export const GetV2ThreadsThreadIdResponse$inboundSchema: z.ZodType<
  GetV2ThreadsThreadIdResponse,
  z.ZodTypeDef,
  unknown
> = z.object({
  data: Thread$inboundSchema,
});

/** @internal */
export type GetV2ThreadsThreadIdResponse$Outbound = {
  data: Thread$Outbound;
};

/** @internal */
export const GetV2ThreadsThreadIdResponse$outboundSchema: z.ZodType<
  GetV2ThreadsThreadIdResponse$Outbound,
  z.ZodTypeDef,
  GetV2ThreadsThreadIdResponse
> = z.object({
  data: Thread$outboundSchema,
});

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

export function getV2ThreadsThreadIdResponseToJSON(
  getV2ThreadsThreadIdResponse: GetV2ThreadsThreadIdResponse,
): string {
  return JSON.stringify(
    GetV2ThreadsThreadIdResponse$outboundSchema.parse(
      getV2ThreadsThreadIdResponse,
    ),
  );
}

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