/*
 * 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 InsertSearchEventId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const InsertSearchEventId$outboundSchema = z.union([z.string(), z.number()]);
export function insertSearchEventIdToJSON(insertSearchEventId) {
    return JSON.stringify(InsertSearchEventId$outboundSchema.parse(insertSearchEventId));
}
export function insertSearchEventIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => InsertSearchEventId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InsertSearchEventId' from JSON`);
}
/** @internal */
export const InsertSearchEventUserId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const InsertSearchEventUserId$outboundSchema = z.union([z.string(), z.number()]);
export function insertSearchEventUserIdToJSON(insertSearchEventUserId) {
    return JSON.stringify(InsertSearchEventUserId$outboundSchema.parse(insertSearchEventUserId));
}
export function insertSearchEventUserIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => InsertSearchEventUserId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InsertSearchEventUserId' from JSON`);
}
/** @internal */
export const InsertSearchEventUserProperties$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 InsertSearchEventUserProperties$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 insertSearchEventUserPropertiesToJSON(insertSearchEventUserProperties) {
    return JSON.stringify(InsertSearchEventUserProperties$outboundSchema.parse(insertSearchEventUserProperties));
}
export function insertSearchEventUserPropertiesFromJSON(jsonString) {
    return safeParse(jsonString, (x) => InsertSearchEventUserProperties$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InsertSearchEventUserProperties' from JSON`);
}
/** @internal */
export const InsertSearchEvent$inboundSchema = z.object({
    id: z.string().optional(),
    type: z.string(),
    searchQuery: 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(() => InsertSearchEventUserProperties$inboundSchema)).optional(),
    entityType: z.literal("search"),
});
/** @internal */
export const InsertSearchEvent$outboundSchema = z.object({
    id: z.string().optional(),
    type: z.string(),
    searchQuery: 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(() => InsertSearchEventUserProperties$outboundSchema)).optional(),
    entityType: z.literal("search"),
});
export function insertSearchEventToJSON(insertSearchEvent) {
    return JSON.stringify(InsertSearchEvent$outboundSchema.parse(insertSearchEvent));
}
export function insertSearchEventFromJSON(jsonString) {
    return safeParse(jsonString, (x) => InsertSearchEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InsertSearchEvent' from JSON`);
}
//# sourceMappingURL=insertsearchevent.js.map