/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import * as z from "zod/v3";
import { remap as remap$ } from "../../lib/primitives.js";
import { collectExtraKeys as collectExtraKeys$, safeParse, } from "../../lib/schemas.js";
import { OpenAIChatCompletionMessage$inboundSchema, OpenAIChatCompletionMessage$outboundSchema, } from "./openaichatcompletionmessage.js";
import { OpenAIExtendedMessage$inboundSchema, OpenAIExtendedMessage$outboundSchema, } from "./openaiextendedmessage.js";
export const OpenAIConversationVisibility = {
    Private: "private",
    Public: "public",
};
/** @internal */
export const OpenAIConversationId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const OpenAIConversationId$outboundSchema = z.union([z.string(), z.number()]);
export function openAIConversationIdToJSON(openAIConversationId) {
    return JSON.stringify(OpenAIConversationId$outboundSchema.parse(openAIConversationId));
}
export function openAIConversationIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => OpenAIConversationId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenAIConversationId' from JSON`);
}
/** @internal */
export const OpenAIConversationUserId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const OpenAIConversationUserId$outboundSchema = z.union([z.string(), z.number()]);
export function openAIConversationUserIdToJSON(openAIConversationUserId) {
    return JSON.stringify(OpenAIConversationUserId$outboundSchema.parse(openAIConversationUserId));
}
export function openAIConversationUserIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => OpenAIConversationUserId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenAIConversationUserId' from JSON`);
}
/** @internal */
export const OpenAIConversationUserProperties$inboundSchema = collectExtraKeys$(z.object({
    id: z.nullable(z.union([z.string(), z.number()])).optional(),
    identificationType: z.nullable(z.string()).optional(),
    userId: z.nullable(z.union([z.string(), z.number()])).optional(),
    supportAgentName: z.nullable(z.string()).optional(),
    userType: z.nullable(z.string()).optional(),
}).catchall(z.any()), "additionalProperties", true);
/** @internal */
export const OpenAIConversationUserProperties$outboundSchema = z.object({
    id: z.nullable(z.union([z.string(), z.number()])).optional(),
    identificationType: z.nullable(z.string()).optional(),
    userId: z.nullable(z.union([z.string(), z.number()])).optional(),
    supportAgentName: z.nullable(z.string()).optional(),
    userType: z.nullable(z.string()).optional(),
    additionalProperties: z.record(z.any()).optional(),
}).transform((v) => {
    return {
        ...v.additionalProperties,
        ...remap$(v, {
            additionalProperties: null,
        }),
    };
});
export function openAIConversationUserPropertiesToJSON(openAIConversationUserProperties) {
    return JSON.stringify(OpenAIConversationUserProperties$outboundSchema.parse(openAIConversationUserProperties));
}
export function openAIConversationUserPropertiesFromJSON(jsonString) {
    return safeParse(jsonString, (x) => OpenAIConversationUserProperties$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenAIConversationUserProperties' from JSON`);
}
/** @internal */
export const OpenAIConversationVisibility$inboundSchema = z.nativeEnum(OpenAIConversationVisibility);
/** @internal */
export const OpenAIConversationVisibility$outboundSchema = OpenAIConversationVisibility$inboundSchema;
/** @internal */
export const OpenAIConversation$inboundSchema = z.object({
    id: z.string(),
    externalId: z.nullable(z.string()),
    externalUrl: z.nullable(z.string()),
    type: z.literal("openai"),
    supportTicketConversationId: z.nullable(z.string()),
    createdAt: z.string(),
    updatedAt: z.string(),
    projectId: z.nullable(z.string()),
    integrationId: z.nullable(z.string()),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.lazy(() => OpenAIConversationUserProperties$inboundSchema)).optional(),
    tags: z.nullable(z.array(z.string())).optional(),
    visibility: z.nullable(OpenAIConversationVisibility$inboundSchema),
    messages: z.array(OpenAIExtendedMessage$inboundSchema),
    messagesOpenAIFormat: z.array(OpenAIChatCompletionMessage$inboundSchema),
});
/** @internal */
export const OpenAIConversation$outboundSchema = z.object({
    id: z.string(),
    externalId: z.nullable(z.string()),
    externalUrl: z.nullable(z.string()),
    type: z.literal("openai"),
    supportTicketConversationId: z.nullable(z.string()),
    createdAt: z.string(),
    updatedAt: z.string(),
    projectId: z.nullable(z.string()),
    integrationId: z.nullable(z.string()),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.lazy(() => OpenAIConversationUserProperties$outboundSchema)).optional(),
    tags: z.nullable(z.array(z.string())).optional(),
    visibility: z.nullable(OpenAIConversationVisibility$outboundSchema),
    messages: z.array(OpenAIExtendedMessage$outboundSchema),
    messagesOpenAIFormat: z.array(OpenAIChatCompletionMessage$outboundSchema),
});
export function openAIConversationToJSON(openAIConversation) {
    return JSON.stringify(OpenAIConversation$outboundSchema.parse(openAIConversation));
}
export function openAIConversationFromJSON(jsonString) {
    return safeParse(jsonString, (x) => OpenAIConversation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenAIConversation' from JSON`);
}
//# sourceMappingURL=openaiconversation.js.map