/*
 * 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 InsertMessageEventId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const InsertMessageEventId$outboundSchema = z.union([z.string(), z.number()]);
export function insertMessageEventIdToJSON(insertMessageEventId) {
    return JSON.stringify(InsertMessageEventId$outboundSchema.parse(insertMessageEventId));
}
export function insertMessageEventIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => InsertMessageEventId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InsertMessageEventId' from JSON`);
}
/** @internal */
export const InsertMessageEventUserId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const InsertMessageEventUserId$outboundSchema = z.union([z.string(), z.number()]);
export function insertMessageEventUserIdToJSON(insertMessageEventUserId) {
    return JSON.stringify(InsertMessageEventUserId$outboundSchema.parse(insertMessageEventUserId));
}
export function insertMessageEventUserIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => InsertMessageEventUserId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InsertMessageEventUserId' from JSON`);
}
/** @internal */
export const InsertMessageEventUserProperties$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 InsertMessageEventUserProperties$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 insertMessageEventUserPropertiesToJSON(insertMessageEventUserProperties) {
    return JSON.stringify(InsertMessageEventUserProperties$outboundSchema.parse(insertMessageEventUserProperties));
}
export function insertMessageEventUserPropertiesFromJSON(jsonString) {
    return safeParse(jsonString, (x) => InsertMessageEventUserProperties$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InsertMessageEventUserProperties' from JSON`);
}
/** @internal */
export const InsertMessageEvent$inboundSchema = z.object({
    id: z.string().optional(),
    type: z.string(),
    messageId: 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(() => InsertMessageEventUserProperties$inboundSchema)).optional(),
    entityType: z.literal("message"),
});
/** @internal */
export const InsertMessageEvent$outboundSchema = z.object({
    id: z.string().optional(),
    type: z.string(),
    messageId: 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(() => InsertMessageEventUserProperties$outboundSchema)).optional(),
    entityType: z.literal("message"),
});
export function insertMessageEventToJSON(insertMessageEvent) {
    return JSON.stringify(InsertMessageEvent$outboundSchema.parse(insertMessageEvent));
}
export function insertMessageEventFromJSON(jsonString) {
    return safeParse(jsonString, (x) => InsertMessageEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InsertMessageEvent' from JSON`);
}
//# sourceMappingURL=insertmessageevent.js.map