/*
 * 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 EntityType = {
    Message: "message",
};
/** @internal */
export const InsertMessageEventId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const InsertMessageEventId$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 InsertMessageEventId$;
(function (InsertMessageEventId$) {
    /** @deprecated use `InsertMessageEventId$inboundSchema` instead. */
    InsertMessageEventId$.inboundSchema = InsertMessageEventId$inboundSchema;
    /** @deprecated use `InsertMessageEventId$outboundSchema` instead. */
    InsertMessageEventId$.outboundSchema = InsertMessageEventId$outboundSchema;
})(InsertMessageEventId$ || (InsertMessageEventId$ = {}));
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()]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var InsertMessageEventUserId$;
(function (InsertMessageEventUserId$) {
    /** @deprecated use `InsertMessageEventUserId$inboundSchema` instead. */
    InsertMessageEventUserId$.inboundSchema = InsertMessageEventUserId$inboundSchema;
    /** @deprecated use `InsertMessageEventUserId$outboundSchema` instead. */
    InsertMessageEventUserId$.outboundSchema = InsertMessageEventUserId$outboundSchema;
})(InsertMessageEventUserId$ || (InsertMessageEventUserId$ = {}));
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(),
}).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(),
    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 InsertMessageEventUserProperties$;
(function (InsertMessageEventUserProperties$) {
    /** @deprecated use `InsertMessageEventUserProperties$inboundSchema` instead. */
    InsertMessageEventUserProperties$.inboundSchema = InsertMessageEventUserProperties$inboundSchema;
    /** @deprecated use `InsertMessageEventUserProperties$outboundSchema` instead. */
    InsertMessageEventUserProperties$.outboundSchema = InsertMessageEventUserProperties$outboundSchema;
})(InsertMessageEventUserProperties$ || (InsertMessageEventUserProperties$ = {}));
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 EntityType$inboundSchema = z
    .nativeEnum(EntityType);
/** @internal */
export const EntityType$outboundSchema = EntityType$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var EntityType$;
(function (EntityType$) {
    /** @deprecated use `EntityType$inboundSchema` instead. */
    EntityType$.inboundSchema = EntityType$inboundSchema;
    /** @deprecated use `EntityType$outboundSchema` instead. */
    EntityType$.outboundSchema = EntityType$outboundSchema;
})(EntityType$ || (EntityType$ = {}));
/** @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: EntityType$inboundSchema,
});
/** @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: EntityType$outboundSchema,
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var InsertMessageEvent$;
(function (InsertMessageEvent$) {
    /** @deprecated use `InsertMessageEvent$inboundSchema` instead. */
    InsertMessageEvent$.inboundSchema = InsertMessageEvent$inboundSchema;
    /** @deprecated use `InsertMessageEvent$outboundSchema` instead. */
    InsertMessageEvent$.outboundSchema = InsertMessageEvent$outboundSchema;
})(InsertMessageEvent$ || (InsertMessageEvent$ = {}));
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