/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import * as z from "zod";
import { remap as remap$ } from "../../lib/primitives.js";
import { collectExtraKeys as collectExtraKeys$, safeParse, } from "../../lib/schemas.js";
export const InsertSearchEventEntityType = {
    Search: "search",
};
/** @internal */
export const InsertSearchEventId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const InsertSearchEventId$outboundSchema = z.union([z.string(), z.number()]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var InsertSearchEventId$;
(function (InsertSearchEventId$) {
    /** @deprecated use `InsertSearchEventId$inboundSchema` instead. */
    InsertSearchEventId$.inboundSchema = InsertSearchEventId$inboundSchema;
    /** @deprecated use `InsertSearchEventId$outboundSchema` instead. */
    InsertSearchEventId$.outboundSchema = InsertSearchEventId$outboundSchema;
})(InsertSearchEventId$ || (InsertSearchEventId$ = {}));
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()]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var InsertSearchEventUserId$;
(function (InsertSearchEventUserId$) {
    /** @deprecated use `InsertSearchEventUserId$inboundSchema` instead. */
    InsertSearchEventUserId$.inboundSchema = InsertSearchEventUserId$inboundSchema;
    /** @deprecated use `InsertSearchEventUserId$outboundSchema` instead. */
    InsertSearchEventUserId$.outboundSchema = InsertSearchEventUserId$outboundSchema;
})(InsertSearchEventUserId$ || (InsertSearchEventUserId$ = {}));
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(),
}).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(),
    additionalProperties: z.record(z.any()),
}).transform((v) => {
    return {
        ...v.additionalProperties,
        ...remap$(v, {
            additionalProperties: null,
        }),
    };
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var InsertSearchEventUserProperties$;
(function (InsertSearchEventUserProperties$) {
    /** @deprecated use `InsertSearchEventUserProperties$inboundSchema` instead. */
    InsertSearchEventUserProperties$.inboundSchema = InsertSearchEventUserProperties$inboundSchema;
    /** @deprecated use `InsertSearchEventUserProperties$outboundSchema` instead. */
    InsertSearchEventUserProperties$.outboundSchema = InsertSearchEventUserProperties$outboundSchema;
})(InsertSearchEventUserProperties$ || (InsertSearchEventUserProperties$ = {}));
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 InsertSearchEventEntityType$inboundSchema = z.nativeEnum(InsertSearchEventEntityType);
/** @internal */
export const InsertSearchEventEntityType$outboundSchema = InsertSearchEventEntityType$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var InsertSearchEventEntityType$;
(function (InsertSearchEventEntityType$) {
    /** @deprecated use `InsertSearchEventEntityType$inboundSchema` instead. */
    InsertSearchEventEntityType$.inboundSchema = InsertSearchEventEntityType$inboundSchema;
    /** @deprecated use `InsertSearchEventEntityType$outboundSchema` instead. */
    InsertSearchEventEntityType$.outboundSchema = InsertSearchEventEntityType$outboundSchema;
})(InsertSearchEventEntityType$ || (InsertSearchEventEntityType$ = {}));
/** @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: InsertSearchEventEntityType$inboundSchema,
});
/** @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: InsertSearchEventEntityType$outboundSchema,
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var InsertSearchEvent$;
(function (InsertSearchEvent$) {
    /** @deprecated use `InsertSearchEvent$inboundSchema` instead. */
    InsertSearchEvent$.inboundSchema = InsertSearchEvent$inboundSchema;
    /** @deprecated use `InsertSearchEvent$outboundSchema` instead. */
    InsertSearchEvent$.outboundSchema = InsertSearchEvent$outboundSchema;
})(InsertSearchEvent$ || (InsertSearchEvent$ = {}));
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