/*
 * 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";
/** @internal */
export const InsertConversationEventId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const InsertConversationEventId$outboundSchema = z.union([z.string(), z.number()]);
export function insertConversationEventIdToJSON(insertConversationEventId) {
    return JSON.stringify(InsertConversationEventId$outboundSchema.parse(insertConversationEventId));
}
export function insertConversationEventIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => InsertConversationEventId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InsertConversationEventId' from JSON`);
}
/** @internal */
export const InsertConversationEventUserId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const InsertConversationEventUserId$outboundSchema = z.union([z.string(), z.number()]);
export function insertConversationEventUserIdToJSON(insertConversationEventUserId) {
    return JSON.stringify(InsertConversationEventUserId$outboundSchema.parse(insertConversationEventUserId));
}
export function insertConversationEventUserIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => InsertConversationEventUserId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InsertConversationEventUserId' from JSON`);
}
/** @internal */
export const InsertConversationEventUserProperties$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 InsertConversationEventUserProperties$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 insertConversationEventUserPropertiesToJSON(insertConversationEventUserProperties) {
    return JSON.stringify(InsertConversationEventUserProperties$outboundSchema.parse(insertConversationEventUserProperties));
}
export function insertConversationEventUserPropertiesFromJSON(jsonString) {
    return safeParse(jsonString, (x) => InsertConversationEventUserProperties$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InsertConversationEventUserProperties' from JSON`);
}
/** @internal */
export const InsertConversationEvent$inboundSchema = z.object({
    id: z.string().optional(),
    type: z.string(),
    conversationId: z.string(),
    createdAt: 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(() => InsertConversationEventUserProperties$inboundSchema)).optional(),
    entityType: z.literal("conversation"),
});
/** @internal */
export const InsertConversationEvent$outboundSchema = z.object({
    id: z.string().optional(),
    type: z.string(),
    conversationId: z.string(),
    createdAt: 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(() => InsertConversationEventUserProperties$outboundSchema)).optional(),
    entityType: z.literal("conversation"),
});
export function insertConversationEventToJSON(insertConversationEvent) {
    return JSON.stringify(InsertConversationEvent$outboundSchema.parse(insertConversationEvent));
}
export function insertConversationEventFromJSON(jsonString) {
    return safeParse(jsonString, (x) => InsertConversationEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InsertConversationEvent' from JSON`);
}
//# sourceMappingURL=insertconversationevent.js.map