"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.InsertSearchEvent$ = exports.InsertSearchEvent$outboundSchema = exports.InsertSearchEvent$inboundSchema = exports.InsertSearchEventEntityType$ = exports.InsertSearchEventEntityType$outboundSchema = exports.InsertSearchEventEntityType$inboundSchema = exports.InsertSearchEventUserProperties$ = exports.InsertSearchEventUserProperties$outboundSchema = exports.InsertSearchEventUserProperties$inboundSchema = exports.InsertSearchEventUserId$ = exports.InsertSearchEventUserId$outboundSchema = exports.InsertSearchEventUserId$inboundSchema = exports.InsertSearchEventId$ = exports.InsertSearchEventId$outboundSchema = exports.InsertSearchEventId$inboundSchema = exports.InsertSearchEventEntityType = void 0;
exports.insertSearchEventIdToJSON = insertSearchEventIdToJSON;
exports.insertSearchEventIdFromJSON = insertSearchEventIdFromJSON;
exports.insertSearchEventUserIdToJSON = insertSearchEventUserIdToJSON;
exports.insertSearchEventUserIdFromJSON = insertSearchEventUserIdFromJSON;
exports.insertSearchEventUserPropertiesToJSON = insertSearchEventUserPropertiesToJSON;
exports.insertSearchEventUserPropertiesFromJSON = insertSearchEventUserPropertiesFromJSON;
exports.insertSearchEventToJSON = insertSearchEventToJSON;
exports.insertSearchEventFromJSON = insertSearchEventFromJSON;
const z = __importStar(require("zod"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
exports.InsertSearchEventEntityType = {
    Search: "search",
};
/** @internal */
exports.InsertSearchEventId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
exports.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.
 */
var InsertSearchEventId$;
(function (InsertSearchEventId$) {
    /** @deprecated use `InsertSearchEventId$inboundSchema` instead. */
    InsertSearchEventId$.inboundSchema = exports.InsertSearchEventId$inboundSchema;
    /** @deprecated use `InsertSearchEventId$outboundSchema` instead. */
    InsertSearchEventId$.outboundSchema = exports.InsertSearchEventId$outboundSchema;
})(InsertSearchEventId$ || (exports.InsertSearchEventId$ = InsertSearchEventId$ = {}));
function insertSearchEventIdToJSON(insertSearchEventId) {
    return JSON.stringify(exports.InsertSearchEventId$outboundSchema.parse(insertSearchEventId));
}
function insertSearchEventIdFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.InsertSearchEventId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InsertSearchEventId' from JSON`);
}
/** @internal */
exports.InsertSearchEventUserId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
exports.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.
 */
var InsertSearchEventUserId$;
(function (InsertSearchEventUserId$) {
    /** @deprecated use `InsertSearchEventUserId$inboundSchema` instead. */
    InsertSearchEventUserId$.inboundSchema = exports.InsertSearchEventUserId$inboundSchema;
    /** @deprecated use `InsertSearchEventUserId$outboundSchema` instead. */
    InsertSearchEventUserId$.outboundSchema = exports.InsertSearchEventUserId$outboundSchema;
})(InsertSearchEventUserId$ || (exports.InsertSearchEventUserId$ = InsertSearchEventUserId$ = {}));
function insertSearchEventUserIdToJSON(insertSearchEventUserId) {
    return JSON.stringify(exports.InsertSearchEventUserId$outboundSchema.parse(insertSearchEventUserId));
}
function insertSearchEventUserIdFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.InsertSearchEventUserId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InsertSearchEventUserId' from JSON`);
}
/** @internal */
exports.InsertSearchEventUserProperties$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(),
}).catchall(z.any()), "additionalProperties", true);
/** @internal */
exports.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,
        ...(0, primitives_js_1.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.
 */
var InsertSearchEventUserProperties$;
(function (InsertSearchEventUserProperties$) {
    /** @deprecated use `InsertSearchEventUserProperties$inboundSchema` instead. */
    InsertSearchEventUserProperties$.inboundSchema = exports.InsertSearchEventUserProperties$inboundSchema;
    /** @deprecated use `InsertSearchEventUserProperties$outboundSchema` instead. */
    InsertSearchEventUserProperties$.outboundSchema = exports.InsertSearchEventUserProperties$outboundSchema;
})(InsertSearchEventUserProperties$ || (exports.InsertSearchEventUserProperties$ = InsertSearchEventUserProperties$ = {}));
function insertSearchEventUserPropertiesToJSON(insertSearchEventUserProperties) {
    return JSON.stringify(exports.InsertSearchEventUserProperties$outboundSchema.parse(insertSearchEventUserProperties));
}
function insertSearchEventUserPropertiesFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.InsertSearchEventUserProperties$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InsertSearchEventUserProperties' from JSON`);
}
/** @internal */
exports.InsertSearchEventEntityType$inboundSchema = z.nativeEnum(exports.InsertSearchEventEntityType);
/** @internal */
exports.InsertSearchEventEntityType$outboundSchema = exports.InsertSearchEventEntityType$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var InsertSearchEventEntityType$;
(function (InsertSearchEventEntityType$) {
    /** @deprecated use `InsertSearchEventEntityType$inboundSchema` instead. */
    InsertSearchEventEntityType$.inboundSchema = exports.InsertSearchEventEntityType$inboundSchema;
    /** @deprecated use `InsertSearchEventEntityType$outboundSchema` instead. */
    InsertSearchEventEntityType$.outboundSchema = exports.InsertSearchEventEntityType$outboundSchema;
})(InsertSearchEventEntityType$ || (exports.InsertSearchEventEntityType$ = InsertSearchEventEntityType$ = {}));
/** @internal */
exports.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(() => exports.InsertSearchEventUserProperties$inboundSchema)).optional(),
    entityType: exports.InsertSearchEventEntityType$inboundSchema,
});
/** @internal */
exports.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(() => exports.InsertSearchEventUserProperties$outboundSchema)).optional(),
    entityType: exports.InsertSearchEventEntityType$outboundSchema,
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var InsertSearchEvent$;
(function (InsertSearchEvent$) {
    /** @deprecated use `InsertSearchEvent$inboundSchema` instead. */
    InsertSearchEvent$.inboundSchema = exports.InsertSearchEvent$inboundSchema;
    /** @deprecated use `InsertSearchEvent$outboundSchema` instead. */
    InsertSearchEvent$.outboundSchema = exports.InsertSearchEvent$outboundSchema;
})(InsertSearchEvent$ || (exports.InsertSearchEvent$ = InsertSearchEvent$ = {}));
function insertSearchEventToJSON(insertSearchEvent) {
    return JSON.stringify(exports.InsertSearchEvent$outboundSchema.parse(insertSearchEvent));
}
function insertSearchEventFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.InsertSearchEvent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InsertSearchEvent' from JSON`);
}
//# sourceMappingURL=insertsearchevent.js.map