/*
 * 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";
import { SupportTicketMessage$inboundSchema, SupportTicketMessage$outboundSchema, } from "./supportticketmessage.js";
export const SupportTicketConversationVisibility = {
    Private: "private",
    Public: "public",
};
/** @internal */
export const SupportTicketConversationId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const SupportTicketConversationId$outboundSchema = z.union([z.string(), z.number()]);
export function supportTicketConversationIdToJSON(supportTicketConversationId) {
    return JSON.stringify(SupportTicketConversationId$outboundSchema.parse(supportTicketConversationId));
}
export function supportTicketConversationIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => SupportTicketConversationId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SupportTicketConversationId' from JSON`);
}
/** @internal */
export const SupportTicketConversationUserId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const SupportTicketConversationUserId$outboundSchema = z.union([z.string(), z.number()]);
export function supportTicketConversationUserIdToJSON(supportTicketConversationUserId) {
    return JSON.stringify(SupportTicketConversationUserId$outboundSchema.parse(supportTicketConversationUserId));
}
export function supportTicketConversationUserIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => SupportTicketConversationUserId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SupportTicketConversationUserId' from JSON`);
}
/** @internal */
export const SupportTicketConversationUserProperties$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 SupportTicketConversationUserProperties$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 supportTicketConversationUserPropertiesToJSON(supportTicketConversationUserProperties) {
    return JSON.stringify(SupportTicketConversationUserProperties$outboundSchema.parse(supportTicketConversationUserProperties));
}
export function supportTicketConversationUserPropertiesFromJSON(jsonString) {
    return safeParse(jsonString, (x) => SupportTicketConversationUserProperties$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SupportTicketConversationUserProperties' from JSON`);
}
/** @internal */
export const SupportTicketConversationVisibility$inboundSchema = z.nativeEnum(SupportTicketConversationVisibility);
/** @internal */
export const SupportTicketConversationVisibility$outboundSchema = SupportTicketConversationVisibility$inboundSchema;
/** @internal */
export const SupportTicketConversation$inboundSchema = z.object({
    id: z.string(),
    externalId: z.nullable(z.string()),
    externalUrl: z.nullable(z.string()),
    type: z.literal("support_ticket"),
    supportTicketConversationId: z.nullable(z.string()),
    createdAt: z.string(),
    updatedAt: z.string(),
    projectId: z.nullable(z.string()),
    integrationId: z.nullable(z.string()),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.lazy(() => SupportTicketConversationUserProperties$inboundSchema)).optional(),
    tags: z.nullable(z.array(z.string())).optional(),
    visibility: z.nullable(SupportTicketConversationVisibility$inboundSchema),
    messages: z.array(SupportTicketMessage$inboundSchema),
});
/** @internal */
export const SupportTicketConversation$outboundSchema = z.object({
    id: z.string(),
    externalId: z.nullable(z.string()),
    externalUrl: z.nullable(z.string()),
    type: z.literal("support_ticket"),
    supportTicketConversationId: z.nullable(z.string()),
    createdAt: z.string(),
    updatedAt: z.string(),
    projectId: z.nullable(z.string()),
    integrationId: z.nullable(z.string()),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.lazy(() => SupportTicketConversationUserProperties$outboundSchema)).optional(),
    tags: z.nullable(z.array(z.string())).optional(),
    visibility: z.nullable(SupportTicketConversationVisibility$outboundSchema),
    messages: z.array(SupportTicketMessage$outboundSchema),
});
export function supportTicketConversationToJSON(supportTicketConversation) {
    return JSON.stringify(SupportTicketConversation$outboundSchema.parse(supportTicketConversation));
}
export function supportTicketConversationFromJSON(jsonString) {
    return safeParse(jsonString, (x) => SupportTicketConversation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SupportTicketConversation' from JSON`);
}
//# sourceMappingURL=supportticketconversation.js.map