"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.OpenAIExtendedMessage$outboundSchema = exports.OpenAIExtendedMessage$inboundSchema = exports.OpenAIExtendedMessageUserProperties$outboundSchema = exports.OpenAIExtendedMessageUserProperties$inboundSchema = exports.OpenAIExtendedMessageUserId$outboundSchema = exports.OpenAIExtendedMessageUserId$inboundSchema = exports.OpenAIExtendedMessageId$outboundSchema = exports.OpenAIExtendedMessageId$inboundSchema = exports.Links$outboundSchema = exports.Links$inboundSchema = exports.OpenAIExtendedMessageLinksType$outboundSchema = exports.OpenAIExtendedMessageLinksType$inboundSchema = exports.One$outboundSchema = exports.One$inboundSchema = exports.Content$outboundSchema = exports.Content$inboundSchema = exports.Role$outboundSchema = exports.Role$inboundSchema = exports.OpenAIExtendedMessageType$outboundSchema = exports.OpenAIExtendedMessageType$inboundSchema = exports.One = exports.Role = exports.OpenAIExtendedMessageType = void 0;
exports.contentToJSON = contentToJSON;
exports.contentFromJSON = contentFromJSON;
exports.openAIExtendedMessageLinksTypeToJSON = openAIExtendedMessageLinksTypeToJSON;
exports.openAIExtendedMessageLinksTypeFromJSON = openAIExtendedMessageLinksTypeFromJSON;
exports.linksToJSON = linksToJSON;
exports.linksFromJSON = linksFromJSON;
exports.openAIExtendedMessageIdToJSON = openAIExtendedMessageIdToJSON;
exports.openAIExtendedMessageIdFromJSON = openAIExtendedMessageIdFromJSON;
exports.openAIExtendedMessageUserIdToJSON = openAIExtendedMessageUserIdToJSON;
exports.openAIExtendedMessageUserIdFromJSON = openAIExtendedMessageUserIdFromJSON;
exports.openAIExtendedMessageUserPropertiesToJSON = openAIExtendedMessageUserPropertiesToJSON;
exports.openAIExtendedMessageUserPropertiesFromJSON = openAIExtendedMessageUserPropertiesFromJSON;
exports.openAIExtendedMessageToJSON = openAIExtendedMessageToJSON;
exports.openAIExtendedMessageFromJSON = openAIExtendedMessageFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const openaicontentitem_js_1 = require("./openaicontentitem.js");
const openaitoolcall_js_1 = require("./openaitoolcall.js");
exports.OpenAIExtendedMessageType = {
    Openai: "openai",
};
exports.Role = {
    System: "system",
    User: "user",
    Assistant: "assistant",
};
exports.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 */
exports.OpenAIExtendedMessageType$inboundSchema = z.nativeEnum(exports.OpenAIExtendedMessageType);
/** @internal */
exports.OpenAIExtendedMessageType$outboundSchema = exports.OpenAIExtendedMessageType$inboundSchema;
/** @internal */
exports.Role$inboundSchema = z.nativeEnum(exports.Role);
/** @internal */
exports.Role$outboundSchema = exports.Role$inboundSchema;
/** @internal */
exports.Content$inboundSchema = z.union([z.string(), z.array(openaicontentitem_js_1.OpenAIContentItem$inboundSchema)]);
/** @internal */
exports.Content$outboundSchema = z.union([z.string(), z.array(openaicontentitem_js_1.OpenAIContentItem$outboundSchema)]);
function contentToJSON(content) {
    return JSON.stringify(exports.Content$outboundSchema.parse(content));
}
function contentFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Content$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Content' from JSON`);
}
/** @internal */
exports.One$inboundSchema = z.nativeEnum(exports.One);
/** @internal */
exports.One$outboundSchema = exports.One$inboundSchema;
/** @internal */
exports.OpenAIExtendedMessageLinksType$inboundSchema = z.union([exports.One$inboundSchema, z.string()]);
/** @internal */
exports.OpenAIExtendedMessageLinksType$outboundSchema = z.union([exports.One$outboundSchema, z.string()]);
function openAIExtendedMessageLinksTypeToJSON(openAIExtendedMessageLinksType) {
    return JSON.stringify(exports.OpenAIExtendedMessageLinksType$outboundSchema.parse(openAIExtendedMessageLinksType));
}
function openAIExtendedMessageLinksTypeFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.OpenAIExtendedMessageLinksType$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenAIExtendedMessageLinksType' from JSON`);
}
/** @internal */
exports.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([exports.One$inboundSchema, z.string()])).optional(),
    breadcrumbs: z.nullable(z.array(z.string())).optional(),
});
/** @internal */
exports.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([exports.One$outboundSchema, z.string()])).optional(),
    breadcrumbs: z.nullable(z.array(z.string())).optional(),
});
function linksToJSON(links) {
    return JSON.stringify(exports.Links$outboundSchema.parse(links));
}
function linksFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Links$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Links' from JSON`);
}
/** @internal */
exports.OpenAIExtendedMessageId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
exports.OpenAIExtendedMessageId$outboundSchema = z.union([z.string(), z.number()]);
function openAIExtendedMessageIdToJSON(openAIExtendedMessageId) {
    return JSON.stringify(exports.OpenAIExtendedMessageId$outboundSchema.parse(openAIExtendedMessageId));
}
function openAIExtendedMessageIdFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.OpenAIExtendedMessageId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenAIExtendedMessageId' from JSON`);
}
/** @internal */
exports.OpenAIExtendedMessageUserId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
exports.OpenAIExtendedMessageUserId$outboundSchema = z.union([z.string(), z.number()]);
function openAIExtendedMessageUserIdToJSON(openAIExtendedMessageUserId) {
    return JSON.stringify(exports.OpenAIExtendedMessageUserId$outboundSchema.parse(openAIExtendedMessageUserId));
}
function openAIExtendedMessageUserIdFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.OpenAIExtendedMessageUserId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenAIExtendedMessageUserId' from JSON`);
}
/** @internal */
exports.OpenAIExtendedMessageUserProperties$inboundSchema = (0, schemas_js_1.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 */
exports.OpenAIExtendedMessageUserProperties$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,
        ...(0, primitives_js_1.remap)(v, {
            additionalProperties: null,
        }),
    };
});
function openAIExtendedMessageUserPropertiesToJSON(openAIExtendedMessageUserProperties) {
    return JSON.stringify(exports.OpenAIExtendedMessageUserProperties$outboundSchema.parse(openAIExtendedMessageUserProperties));
}
function openAIExtendedMessageUserPropertiesFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.OpenAIExtendedMessageUserProperties$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenAIExtendedMessageUserProperties' from JSON`);
}
/** @internal */
exports.OpenAIExtendedMessage$inboundSchema = z.object({
    id: z.string(),
    type: exports.OpenAIExtendedMessageType$inboundSchema,
    externalId: z.nullable(z.string()),
    externalUrl: z.nullable(z.string()),
    conversationId: z.string(),
    createdAt: z.string(),
    updatedAt: z.string(),
    role: exports.Role$inboundSchema,
    content: z.union([z.string(), z.array(openaicontentitem_js_1.OpenAIContentItem$inboundSchema)]),
    name: z.nullable(z.string()).optional(),
    links: z.nullable(z.array(z.lazy(() => exports.Links$inboundSchema))).optional(),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.lazy(() => exports.OpenAIExtendedMessageUserProperties$inboundSchema)).optional(),
    tool_calls: z.nullable(z.array(openaitoolcall_js_1.OpenAIToolCall$inboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "tool_calls": "toolCalls",
    });
});
/** @internal */
exports.OpenAIExtendedMessage$outboundSchema = z.object({
    id: z.string(),
    type: exports.OpenAIExtendedMessageType$outboundSchema,
    externalId: z.nullable(z.string()),
    externalUrl: z.nullable(z.string()),
    conversationId: z.string(),
    createdAt: z.string(),
    updatedAt: z.string(),
    role: exports.Role$outboundSchema,
    content: z.union([z.string(), z.array(openaicontentitem_js_1.OpenAIContentItem$outboundSchema)]),
    name: z.nullable(z.string()).optional(),
    links: z.nullable(z.array(z.lazy(() => exports.Links$outboundSchema))).optional(),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.lazy(() => exports.OpenAIExtendedMessageUserProperties$outboundSchema)).optional(),
    toolCalls: z.nullable(z.array(openaitoolcall_js_1.OpenAIToolCall$outboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        toolCalls: "tool_calls",
    });
});
function openAIExtendedMessageToJSON(openAIExtendedMessage) {
    return JSON.stringify(exports.OpenAIExtendedMessage$outboundSchema.parse(openAIExtendedMessage));
}
function openAIExtendedMessageFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.OpenAIExtendedMessage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenAIExtendedMessage' from JSON`);
}
//# sourceMappingURL=openaiextendedmessage.js.map