/*
 * 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 { OpenAIContentItem$inboundSchema, OpenAIContentItem$outboundSchema, } from "./openaicontentitem.js";
import { OpenAIToolCall$inboundSchema, OpenAIToolCall$outboundSchema, } from "./openaitoolcall.js";
export const OpenAIExtendedMessageType = {
    Openai: "openai",
};
export const Role = {
    System: "system",
    User: "user",
    Assistant: "assistant",
};
export const One = {
    Documentation: "documentation",
    Site: "site",
    DiscoursePost: "discourse_post",
    GithubIssue: "github_issue",
    GithubDiscussion: "github_discussion",
    StackoverflowQuestion: "stackoverflow_question",
    DiscordForumPost: "discord_forum_post",
    DiscordMessage: "discord_message",
    CustomQuestionAnswer: "custom_question_answer",
};
/** @internal */
export const OpenAIExtendedMessageType$inboundSchema = z.nativeEnum(OpenAIExtendedMessageType);
/** @internal */
export const OpenAIExtendedMessageType$outboundSchema = OpenAIExtendedMessageType$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var OpenAIExtendedMessageType$;
(function (OpenAIExtendedMessageType$) {
    /** @deprecated use `OpenAIExtendedMessageType$inboundSchema` instead. */
    OpenAIExtendedMessageType$.inboundSchema = OpenAIExtendedMessageType$inboundSchema;
    /** @deprecated use `OpenAIExtendedMessageType$outboundSchema` instead. */
    OpenAIExtendedMessageType$.outboundSchema = OpenAIExtendedMessageType$outboundSchema;
})(OpenAIExtendedMessageType$ || (OpenAIExtendedMessageType$ = {}));
/** @internal */
export const Role$inboundSchema = z.nativeEnum(Role);
/** @internal */
export const Role$outboundSchema = Role$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Role$;
(function (Role$) {
    /** @deprecated use `Role$inboundSchema` instead. */
    Role$.inboundSchema = Role$inboundSchema;
    /** @deprecated use `Role$outboundSchema` instead. */
    Role$.outboundSchema = Role$outboundSchema;
})(Role$ || (Role$ = {}));
/** @internal */
export const Content$inboundSchema = z.union([z.string(), z.array(OpenAIContentItem$inboundSchema)]);
/** @internal */
export const Content$outboundSchema = z.union([z.string(), z.array(OpenAIContentItem$outboundSchema)]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Content$;
(function (Content$) {
    /** @deprecated use `Content$inboundSchema` instead. */
    Content$.inboundSchema = Content$inboundSchema;
    /** @deprecated use `Content$outboundSchema` instead. */
    Content$.outboundSchema = Content$outboundSchema;
})(Content$ || (Content$ = {}));
export function contentToJSON(content) {
    return JSON.stringify(Content$outboundSchema.parse(content));
}
export function contentFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Content$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Content' from JSON`);
}
/** @internal */
export const One$inboundSchema = z.nativeEnum(One);
/** @internal */
export const One$outboundSchema = One$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var One$;
(function (One$) {
    /** @deprecated use `One$inboundSchema` instead. */
    One$.inboundSchema = One$inboundSchema;
    /** @deprecated use `One$outboundSchema` instead. */
    One$.outboundSchema = One$outboundSchema;
})(One$ || (One$ = {}));
/** @internal */
export const OpenAIExtendedMessageLinksType$inboundSchema = z.union([One$inboundSchema, z.string()]);
/** @internal */
export const OpenAIExtendedMessageLinksType$outboundSchema = z.union([One$outboundSchema, z.string()]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var OpenAIExtendedMessageLinksType$;
(function (OpenAIExtendedMessageLinksType$) {
    /** @deprecated use `OpenAIExtendedMessageLinksType$inboundSchema` instead. */
    OpenAIExtendedMessageLinksType$.inboundSchema = OpenAIExtendedMessageLinksType$inboundSchema;
    /** @deprecated use `OpenAIExtendedMessageLinksType$outboundSchema` instead. */
    OpenAIExtendedMessageLinksType$.outboundSchema = OpenAIExtendedMessageLinksType$outboundSchema;
})(OpenAIExtendedMessageLinksType$ || (OpenAIExtendedMessageLinksType$ = {}));
export function openAIExtendedMessageLinksTypeToJSON(openAIExtendedMessageLinksType) {
    return JSON.stringify(OpenAIExtendedMessageLinksType$outboundSchema.parse(openAIExtendedMessageLinksType));
}
export function openAIExtendedMessageLinksTypeFromJSON(jsonString) {
    return safeParse(jsonString, (x) => OpenAIExtendedMessageLinksType$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenAIExtendedMessageLinksType' from JSON`);
}
/** @internal */
export const Links$inboundSchema = z
    .object({
    label: z.nullable(z.string()).optional(),
    url: z.string(),
    title: z.nullable(z.string()).optional(),
    description: z.nullable(z.string()).optional(),
    type: z.nullable(z.union([One$inboundSchema, z.string()])).optional(),
    breadcrumbs: z.nullable(z.array(z.string())).optional(),
});
/** @internal */
export const Links$outboundSchema = z.object({
    label: z.nullable(z.string()).optional(),
    url: z.string(),
    title: z.nullable(z.string()).optional(),
    description: z.nullable(z.string()).optional(),
    type: z.nullable(z.union([One$outboundSchema, z.string()])).optional(),
    breadcrumbs: z.nullable(z.array(z.string())).optional(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Links$;
(function (Links$) {
    /** @deprecated use `Links$inboundSchema` instead. */
    Links$.inboundSchema = Links$inboundSchema;
    /** @deprecated use `Links$outboundSchema` instead. */
    Links$.outboundSchema = Links$outboundSchema;
})(Links$ || (Links$ = {}));
export function linksToJSON(links) {
    return JSON.stringify(Links$outboundSchema.parse(links));
}
export function linksFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Links$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Links' from JSON`);
}
/** @internal */
export const OpenAIExtendedMessage$inboundSchema = z.object({
    id: z.string(),
    type: OpenAIExtendedMessageType$inboundSchema,
    externalId: z.nullable(z.string()),
    externalUrl: z.nullable(z.string()),
    conversationId: z.string(),
    createdAt: z.string(),
    updatedAt: z.string(),
    role: Role$inboundSchema,
    content: z.union([z.string(), z.array(OpenAIContentItem$inboundSchema)]),
    name: z.nullable(z.string()).optional(),
    links: z.nullable(z.array(z.lazy(() => Links$inboundSchema))).optional(),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.record(z.any())).optional(),
    tool_calls: z.nullable(z.array(OpenAIToolCall$inboundSchema)).optional(),
}).transform((v) => {
    return remap$(v, {
        "tool_calls": "toolCalls",
    });
});
/** @internal */
export const OpenAIExtendedMessage$outboundSchema = z.object({
    id: z.string(),
    type: OpenAIExtendedMessageType$outboundSchema,
    externalId: z.nullable(z.string()),
    externalUrl: z.nullable(z.string()),
    conversationId: z.string(),
    createdAt: z.string(),
    updatedAt: z.string(),
    role: Role$outboundSchema,
    content: z.union([z.string(), z.array(OpenAIContentItem$outboundSchema)]),
    name: z.nullable(z.string()).optional(),
    links: z.nullable(z.array(z.lazy(() => Links$outboundSchema))).optional(),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.record(z.any())).optional(),
    toolCalls: z.nullable(z.array(OpenAIToolCall$outboundSchema)).optional(),
}).transform((v) => {
    return remap$(v, {
        toolCalls: "tool_calls",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var OpenAIExtendedMessage$;
(function (OpenAIExtendedMessage$) {
    /** @deprecated use `OpenAIExtendedMessage$inboundSchema` instead. */
    OpenAIExtendedMessage$.inboundSchema = OpenAIExtendedMessage$inboundSchema;
    /** @deprecated use `OpenAIExtendedMessage$outboundSchema` instead. */
    OpenAIExtendedMessage$.outboundSchema = OpenAIExtendedMessage$outboundSchema;
})(OpenAIExtendedMessage$ || (OpenAIExtendedMessage$ = {}));
export function openAIExtendedMessageToJSON(openAIExtendedMessage) {
    return JSON.stringify(OpenAIExtendedMessage$outboundSchema.parse(openAIExtendedMessage));
}
export function openAIExtendedMessageFromJSON(jsonString) {
    return safeParse(jsonString, (x) => OpenAIExtendedMessage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenAIExtendedMessage' from JSON`);
}
//# sourceMappingURL=openaiextendedmessage.js.map