"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.CreateOpenAIConversation$outboundSchema = exports.CreateOpenAIConversation$inboundSchema = exports.Messages$outboundSchema = exports.Messages$inboundSchema = exports.CreateOpenAIConversationUserProperties$outboundSchema = exports.CreateOpenAIConversationUserProperties$inboundSchema = exports.CreateOpenAIConversationUserId$outboundSchema = exports.CreateOpenAIConversationUserId$inboundSchema = exports.CreateOpenAIConversationId$outboundSchema = exports.CreateOpenAIConversationId$inboundSchema = exports.CreateOpenAIConversationLinks$outboundSchema = exports.CreateOpenAIConversationLinks$inboundSchema = exports.CreateOpenAIConversationType$outboundSchema = exports.CreateOpenAIConversationType$inboundSchema = exports.CreateOpenAIConversationType1$outboundSchema = exports.CreateOpenAIConversationType1$inboundSchema = exports.CreateOpenAIConversationContent$outboundSchema = exports.CreateOpenAIConversationContent$inboundSchema = exports.CreateOpenAIConversationRole$outboundSchema = exports.CreateOpenAIConversationRole$inboundSchema = exports.Visibility$outboundSchema = exports.Visibility$inboundSchema = exports.UserProperties$outboundSchema = exports.UserProperties$inboundSchema = exports.UserId$outboundSchema = exports.UserId$inboundSchema = exports.Id$outboundSchema = exports.Id$inboundSchema = exports.CreateOpenAIConversationType1 = exports.CreateOpenAIConversationRole = exports.Visibility = void 0;
exports.idToJSON = idToJSON;
exports.idFromJSON = idFromJSON;
exports.userIdToJSON = userIdToJSON;
exports.userIdFromJSON = userIdFromJSON;
exports.userPropertiesToJSON = userPropertiesToJSON;
exports.userPropertiesFromJSON = userPropertiesFromJSON;
exports.createOpenAIConversationContentToJSON = createOpenAIConversationContentToJSON;
exports.createOpenAIConversationContentFromJSON = createOpenAIConversationContentFromJSON;
exports.createOpenAIConversationTypeToJSON = createOpenAIConversationTypeToJSON;
exports.createOpenAIConversationTypeFromJSON = createOpenAIConversationTypeFromJSON;
exports.createOpenAIConversationLinksToJSON = createOpenAIConversationLinksToJSON;
exports.createOpenAIConversationLinksFromJSON = createOpenAIConversationLinksFromJSON;
exports.createOpenAIConversationIdToJSON = createOpenAIConversationIdToJSON;
exports.createOpenAIConversationIdFromJSON = createOpenAIConversationIdFromJSON;
exports.createOpenAIConversationUserIdToJSON = createOpenAIConversationUserIdToJSON;
exports.createOpenAIConversationUserIdFromJSON = createOpenAIConversationUserIdFromJSON;
exports.createOpenAIConversationUserPropertiesToJSON = createOpenAIConversationUserPropertiesToJSON;
exports.createOpenAIConversationUserPropertiesFromJSON = createOpenAIConversationUserPropertiesFromJSON;
exports.messagesToJSON = messagesToJSON;
exports.messagesFromJSON = messagesFromJSON;
exports.createOpenAIConversationToJSON = createOpenAIConversationToJSON;
exports.createOpenAIConversationFromJSON = createOpenAIConversationFromJSON;
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.Visibility = {
    Private: "private",
    Public: "public",
};
exports.CreateOpenAIConversationRole = {
    System: "system",
    User: "user",
    Assistant: "assistant",
};
exports.CreateOpenAIConversationType1 = {
    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.Id$inboundSchema = z.union([
    z.string(),
    z.number(),
]);
/** @internal */
exports.Id$outboundSchema = z
    .union([z.string(), z.number()]);
function idToJSON(id) {
    return JSON.stringify(exports.Id$outboundSchema.parse(id));
}
function idFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Id$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Id' from JSON`);
}
/** @internal */
exports.UserId$inboundSchema = z
    .union([z.string(), z.number()]);
/** @internal */
exports.UserId$outboundSchema = z.union([z.string(), z.number()]);
function userIdToJSON(userId) {
    return JSON.stringify(exports.UserId$outboundSchema.parse(userId));
}
function userIdFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.UserId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UserId' from JSON`);
}
/** @internal */
exports.UserProperties$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.UserProperties$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 userPropertiesToJSON(userProperties) {
    return JSON.stringify(exports.UserProperties$outboundSchema.parse(userProperties));
}
function userPropertiesFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.UserProperties$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UserProperties' from JSON`);
}
/** @internal */
exports.Visibility$inboundSchema = z
    .nativeEnum(exports.Visibility);
/** @internal */
exports.Visibility$outboundSchema = exports.Visibility$inboundSchema;
/** @internal */
exports.CreateOpenAIConversationRole$inboundSchema = z.nativeEnum(exports.CreateOpenAIConversationRole);
/** @internal */
exports.CreateOpenAIConversationRole$outboundSchema = exports.CreateOpenAIConversationRole$inboundSchema;
/** @internal */
exports.CreateOpenAIConversationContent$inboundSchema = z.union([z.string(), z.array(openaicontentitem_js_1.OpenAIContentItem$inboundSchema)]);
/** @internal */
exports.CreateOpenAIConversationContent$outboundSchema = z.union([z.string(), z.array(openaicontentitem_js_1.OpenAIContentItem$outboundSchema)]);
function createOpenAIConversationContentToJSON(createOpenAIConversationContent) {
    return JSON.stringify(exports.CreateOpenAIConversationContent$outboundSchema.parse(createOpenAIConversationContent));
}
function createOpenAIConversationContentFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateOpenAIConversationContent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateOpenAIConversationContent' from JSON`);
}
/** @internal */
exports.CreateOpenAIConversationType1$inboundSchema = z.nativeEnum(exports.CreateOpenAIConversationType1);
/** @internal */
exports.CreateOpenAIConversationType1$outboundSchema = exports.CreateOpenAIConversationType1$inboundSchema;
/** @internal */
exports.CreateOpenAIConversationType$inboundSchema = z.union([exports.CreateOpenAIConversationType1$inboundSchema, z.string()]);
/** @internal */
exports.CreateOpenAIConversationType$outboundSchema = z.union([exports.CreateOpenAIConversationType1$outboundSchema, z.string()]);
function createOpenAIConversationTypeToJSON(createOpenAIConversationType) {
    return JSON.stringify(exports.CreateOpenAIConversationType$outboundSchema.parse(createOpenAIConversationType));
}
function createOpenAIConversationTypeFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateOpenAIConversationType$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateOpenAIConversationType' from JSON`);
}
/** @internal */
exports.CreateOpenAIConversationLinks$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.CreateOpenAIConversationType1$inboundSchema, z.string()])).optional(),
    breadcrumbs: z.nullable(z.array(z.string())).optional(),
});
/** @internal */
exports.CreateOpenAIConversationLinks$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.CreateOpenAIConversationType1$outboundSchema, z.string()])).optional(),
    breadcrumbs: z.nullable(z.array(z.string())).optional(),
});
function createOpenAIConversationLinksToJSON(createOpenAIConversationLinks) {
    return JSON.stringify(exports.CreateOpenAIConversationLinks$outboundSchema.parse(createOpenAIConversationLinks));
}
function createOpenAIConversationLinksFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateOpenAIConversationLinks$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateOpenAIConversationLinks' from JSON`);
}
/** @internal */
exports.CreateOpenAIConversationId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
exports.CreateOpenAIConversationId$outboundSchema = z.union([z.string(), z.number()]);
function createOpenAIConversationIdToJSON(createOpenAIConversationId) {
    return JSON.stringify(exports.CreateOpenAIConversationId$outboundSchema.parse(createOpenAIConversationId));
}
function createOpenAIConversationIdFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateOpenAIConversationId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateOpenAIConversationId' from JSON`);
}
/** @internal */
exports.CreateOpenAIConversationUserId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
exports.CreateOpenAIConversationUserId$outboundSchema = z.union([z.string(), z.number()]);
function createOpenAIConversationUserIdToJSON(createOpenAIConversationUserId) {
    return JSON.stringify(exports.CreateOpenAIConversationUserId$outboundSchema.parse(createOpenAIConversationUserId));
}
function createOpenAIConversationUserIdFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateOpenAIConversationUserId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateOpenAIConversationUserId' from JSON`);
}
/** @internal */
exports.CreateOpenAIConversationUserProperties$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.CreateOpenAIConversationUserProperties$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 createOpenAIConversationUserPropertiesToJSON(createOpenAIConversationUserProperties) {
    return JSON.stringify(exports.CreateOpenAIConversationUserProperties$outboundSchema.parse(createOpenAIConversationUserProperties));
}
function createOpenAIConversationUserPropertiesFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateOpenAIConversationUserProperties$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateOpenAIConversationUserProperties' from JSON`);
}
/** @internal */
exports.Messages$inboundSchema = z.object({
    id: z.string().optional(),
    externalId: z.nullable(z.string()).optional(),
    externalUrl: z.nullable(z.string()).optional(),
    createdAt: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    updatedAt: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    role: exports.CreateOpenAIConversationRole$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.CreateOpenAIConversationLinks$inboundSchema))).optional(),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.lazy(() => exports.CreateOpenAIConversationUserProperties$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.Messages$outboundSchema = z.object({
    id: z.string().optional(),
    externalId: z.nullable(z.string()).optional(),
    externalUrl: z.nullable(z.string()).optional(),
    createdAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    updatedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    role: exports.CreateOpenAIConversationRole$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.CreateOpenAIConversationLinks$outboundSchema))).optional(),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.lazy(() => exports.CreateOpenAIConversationUserProperties$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 messagesToJSON(messages) {
    return JSON.stringify(exports.Messages$outboundSchema.parse(messages));
}
function messagesFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Messages$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Messages' from JSON`);
}
/** @internal */
exports.CreateOpenAIConversation$inboundSchema = z.object({
    id: z.string().optional(),
    externalId: z.nullable(z.string()).optional(),
    externalUrl: z.nullable(z.string()).optional(),
    type: z.literal("openai"),
    supportTicketConversationId: z.nullable(z.string()).optional(),
    createdAt: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    updatedAt: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    projectId: z.nullable(z.string()).optional(),
    integrationId: z.nullable(z.string()).optional(),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.lazy(() => exports.UserProperties$inboundSchema))
        .optional(),
    tags: z.nullable(z.array(z.string())).optional(),
    visibility: z.nullable(exports.Visibility$inboundSchema).optional(),
    messages: z.array(z.lazy(() => exports.Messages$inboundSchema)),
});
/** @internal */
exports.CreateOpenAIConversation$outboundSchema = z.object({
    id: z.string().optional(),
    externalId: z.nullable(z.string()).optional(),
    externalUrl: z.nullable(z.string()).optional(),
    type: z.literal("openai"),
    supportTicketConversationId: z.nullable(z.string()).optional(),
    createdAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    updatedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    projectId: z.nullable(z.string()).optional(),
    integrationId: z.nullable(z.string()).optional(),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.lazy(() => exports.UserProperties$outboundSchema))
        .optional(),
    tags: z.nullable(z.array(z.string())).optional(),
    visibility: z.nullable(exports.Visibility$outboundSchema).optional(),
    messages: z.array(z.lazy(() => exports.Messages$outboundSchema)),
});
function createOpenAIConversationToJSON(createOpenAIConversation) {
    return JSON.stringify(exports.CreateOpenAIConversation$outboundSchema.parse(createOpenAIConversation));
}
function createOpenAIConversationFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateOpenAIConversation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateOpenAIConversation' from JSON`);
}
//# sourceMappingURL=createopenaiconversation.js.map