/*
 * 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";
export const SupportTicketMessageType = {
    SupportTicket: "support_ticket",
};
export const Type1 = {
    Documentation: "documentation",
    Site: "site",
    DiscoursePost: "discourse_post",
    GithubIssue: "github_issue",
    GithubDiscussion: "github_discussion",
    StackoverflowQuestion: "stackoverflow_question",
    DiscordForumPost: "discord_forum_post",
    DiscordMessage: "discord_message",
    CustomQuestionAnswer: "custom_question_answer",
};
/** @internal */
export const SupportTicketMessageType$inboundSchema = z.nativeEnum(SupportTicketMessageType);
/** @internal */
export const SupportTicketMessageType$outboundSchema = SupportTicketMessageType$inboundSchema;
/** @internal */
export const Type1$inboundSchema = z.nativeEnum(Type1);
/** @internal */
export const Type1$outboundSchema = Type1$inboundSchema;
/** @internal */
export const SupportTicketMessageLinksType$inboundSchema = z.union([Type1$inboundSchema, z.string()]);
/** @internal */
export const SupportTicketMessageLinksType$outboundSchema = z.union([Type1$outboundSchema, z.string()]);
export function supportTicketMessageLinksTypeToJSON(supportTicketMessageLinksType) {
    return JSON.stringify(SupportTicketMessageLinksType$outboundSchema.parse(supportTicketMessageLinksType));
}
export function supportTicketMessageLinksTypeFromJSON(jsonString) {
    return safeParse(jsonString, (x) => SupportTicketMessageLinksType$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SupportTicketMessageLinksType' from JSON`);
}
/** @internal */
export const SupportTicketMessageLinks$inboundSchema = z.object({
    label: z.nullable(z.string()).optional(),
    url: z.string(),
    title: z.nullable(z.string()).optional(),
    description: z.nullable(z.string()).optional(),
    type: z.nullable(z.union([Type1$inboundSchema, z.string()])).optional(),
    breadcrumbs: z.nullable(z.array(z.string())).optional(),
});
/** @internal */
export const SupportTicketMessageLinks$outboundSchema = z.object({
    label: z.nullable(z.string()).optional(),
    url: z.string(),
    title: z.nullable(z.string()).optional(),
    description: z.nullable(z.string()).optional(),
    type: z.nullable(z.union([Type1$outboundSchema, z.string()])).optional(),
    breadcrumbs: z.nullable(z.array(z.string())).optional(),
});
export function supportTicketMessageLinksToJSON(supportTicketMessageLinks) {
    return JSON.stringify(SupportTicketMessageLinks$outboundSchema.parse(supportTicketMessageLinks));
}
export function supportTicketMessageLinksFromJSON(jsonString) {
    return safeParse(jsonString, (x) => SupportTicketMessageLinks$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SupportTicketMessageLinks' from JSON`);
}
/** @internal */
export const SupportTicketMessageId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const SupportTicketMessageId$outboundSchema = z.union([z.string(), z.number()]);
export function supportTicketMessageIdToJSON(supportTicketMessageId) {
    return JSON.stringify(SupportTicketMessageId$outboundSchema.parse(supportTicketMessageId));
}
export function supportTicketMessageIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => SupportTicketMessageId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SupportTicketMessageId' from JSON`);
}
/** @internal */
export const SupportTicketMessageUserId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const SupportTicketMessageUserId$outboundSchema = z.union([z.string(), z.number()]);
export function supportTicketMessageUserIdToJSON(supportTicketMessageUserId) {
    return JSON.stringify(SupportTicketMessageUserId$outboundSchema.parse(supportTicketMessageUserId));
}
export function supportTicketMessageUserIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => SupportTicketMessageUserId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SupportTicketMessageUserId' from JSON`);
}
/** @internal */
export const SupportTicketMessageUserProperties$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 SupportTicketMessageUserProperties$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 supportTicketMessageUserPropertiesToJSON(supportTicketMessageUserProperties) {
    return JSON.stringify(SupportTicketMessageUserProperties$outboundSchema.parse(supportTicketMessageUserProperties));
}
export function supportTicketMessageUserPropertiesFromJSON(jsonString) {
    return safeParse(jsonString, (x) => SupportTicketMessageUserProperties$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SupportTicketMessageUserProperties' from JSON`);
}
/** @internal */
export const SupportTicketMessage$inboundSchema = z.object({
    id: z.string(),
    type: SupportTicketMessageType$inboundSchema,
    externalId: z.nullable(z.string()),
    externalUrl: z.nullable(z.string()),
    conversationId: z.string(),
    createdAt: z.string(),
    updatedAt: z.string(),
    role: z.string(),
    content: z.nullable(z.string()),
    name: z.nullable(z.string()).optional(),
    links: z.nullable(z.array(z.lazy(() => SupportTicketMessageLinks$inboundSchema))).optional(),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.lazy(() => SupportTicketMessageUserProperties$inboundSchema)).optional(),
});
/** @internal */
export const SupportTicketMessage$outboundSchema = z.object({
    id: z.string(),
    type: SupportTicketMessageType$outboundSchema,
    externalId: z.nullable(z.string()),
    externalUrl: z.nullable(z.string()),
    conversationId: z.string(),
    createdAt: z.string(),
    updatedAt: z.string(),
    role: z.string(),
    content: z.nullable(z.string()),
    name: z.nullable(z.string()).optional(),
    links: z.nullable(z.array(z.lazy(() => SupportTicketMessageLinks$outboundSchema))).optional(),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.lazy(() => SupportTicketMessageUserProperties$outboundSchema)).optional(),
});
export function supportTicketMessageToJSON(supportTicketMessage) {
    return JSON.stringify(SupportTicketMessage$outboundSchema.parse(supportTicketMessage));
}
export function supportTicketMessageFromJSON(jsonString) {
    return safeParse(jsonString, (x) => SupportTicketMessage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SupportTicketMessage' from JSON`);
}
//# sourceMappingURL=supportticketmessage.js.map