/*
 * 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 CreateSupportTicketConversationVisibility = {
    Private: "private",
    Public: "public",
};
export const CreateSupportTicketConversationType1 = {
    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 CreateSupportTicketConversationId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const CreateSupportTicketConversationId$outboundSchema = z.union([z.string(), z.number()]);
export function createSupportTicketConversationIdToJSON(createSupportTicketConversationId) {
    return JSON.stringify(CreateSupportTicketConversationId$outboundSchema.parse(createSupportTicketConversationId));
}
export function createSupportTicketConversationIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateSupportTicketConversationId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateSupportTicketConversationId' from JSON`);
}
/** @internal */
export const CreateSupportTicketConversationUserId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const CreateSupportTicketConversationUserId$outboundSchema = z.union([z.string(), z.number()]);
export function createSupportTicketConversationUserIdToJSON(createSupportTicketConversationUserId) {
    return JSON.stringify(CreateSupportTicketConversationUserId$outboundSchema.parse(createSupportTicketConversationUserId));
}
export function createSupportTicketConversationUserIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateSupportTicketConversationUserId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateSupportTicketConversationUserId' from JSON`);
}
/** @internal */
export const CreateSupportTicketConversationUserProperties$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 CreateSupportTicketConversationUserProperties$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 createSupportTicketConversationUserPropertiesToJSON(createSupportTicketConversationUserProperties) {
    return JSON.stringify(CreateSupportTicketConversationUserProperties$outboundSchema.parse(createSupportTicketConversationUserProperties));
}
export function createSupportTicketConversationUserPropertiesFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateSupportTicketConversationUserProperties$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateSupportTicketConversationUserProperties' from JSON`);
}
/** @internal */
export const CreateSupportTicketConversationVisibility$inboundSchema = z
    .nativeEnum(CreateSupportTicketConversationVisibility);
/** @internal */
export const CreateSupportTicketConversationVisibility$outboundSchema = CreateSupportTicketConversationVisibility$inboundSchema;
/** @internal */
export const CreateSupportTicketConversationType1$inboundSchema = z.nativeEnum(CreateSupportTicketConversationType1);
/** @internal */
export const CreateSupportTicketConversationType1$outboundSchema = CreateSupportTicketConversationType1$inboundSchema;
/** @internal */
export const CreateSupportTicketConversationMessagesType$inboundSchema = z.union([CreateSupportTicketConversationType1$inboundSchema, z.string()]);
/** @internal */
export const CreateSupportTicketConversationMessagesType$outboundSchema = z.union([
    CreateSupportTicketConversationType1$outboundSchema,
    z.string(),
]);
export function createSupportTicketConversationMessagesTypeToJSON(createSupportTicketConversationMessagesType) {
    return JSON.stringify(CreateSupportTicketConversationMessagesType$outboundSchema.parse(createSupportTicketConversationMessagesType));
}
export function createSupportTicketConversationMessagesTypeFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateSupportTicketConversationMessagesType$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateSupportTicketConversationMessagesType' from JSON`);
}
/** @internal */
export const CreateSupportTicketConversationLinks$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([CreateSupportTicketConversationType1$inboundSchema, z.string()])).optional(),
    breadcrumbs: z.nullable(z.array(z.string())).optional(),
});
/** @internal */
export const CreateSupportTicketConversationLinks$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([CreateSupportTicketConversationType1$outboundSchema, z.string()])).optional(),
    breadcrumbs: z.nullable(z.array(z.string())).optional(),
});
export function createSupportTicketConversationLinksToJSON(createSupportTicketConversationLinks) {
    return JSON.stringify(CreateSupportTicketConversationLinks$outboundSchema.parse(createSupportTicketConversationLinks));
}
export function createSupportTicketConversationLinksFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateSupportTicketConversationLinks$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateSupportTicketConversationLinks' from JSON`);
}
/** @internal */
export const CreateSupportTicketConversationMessagesId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const CreateSupportTicketConversationMessagesId$outboundSchema = z.union([z.string(), z.number()]);
export function createSupportTicketConversationMessagesIdToJSON(createSupportTicketConversationMessagesId) {
    return JSON.stringify(CreateSupportTicketConversationMessagesId$outboundSchema.parse(createSupportTicketConversationMessagesId));
}
export function createSupportTicketConversationMessagesIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateSupportTicketConversationMessagesId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateSupportTicketConversationMessagesId' from JSON`);
}
/** @internal */
export const CreateSupportTicketConversationMessagesUserId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const CreateSupportTicketConversationMessagesUserId$outboundSchema = z.union([z.string(), z.number()]);
export function createSupportTicketConversationMessagesUserIdToJSON(createSupportTicketConversationMessagesUserId) {
    return JSON.stringify(CreateSupportTicketConversationMessagesUserId$outboundSchema.parse(createSupportTicketConversationMessagesUserId));
}
export function createSupportTicketConversationMessagesUserIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateSupportTicketConversationMessagesUserId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateSupportTicketConversationMessagesUserId' from JSON`);
}
/** @internal */
export const CreateSupportTicketConversationMessagesUserProperties$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 CreateSupportTicketConversationMessagesUserProperties$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 createSupportTicketConversationMessagesUserPropertiesToJSON(createSupportTicketConversationMessagesUserProperties) {
    return JSON.stringify(CreateSupportTicketConversationMessagesUserProperties$outboundSchema.parse(createSupportTicketConversationMessagesUserProperties));
}
export function createSupportTicketConversationMessagesUserPropertiesFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateSupportTicketConversationMessagesUserProperties$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateSupportTicketConversationMessagesUserProperties' from JSON`);
}
/** @internal */
export const CreateSupportTicketConversationMessages$inboundSchema = z.object({
    id: z.string().optional(),
    externalId: z.nullable(z.string()).optional(),
    externalUrl: z.nullable(z.string()).optional(),
    createdAt: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    updatedAt: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    role: z.string(),
    content: z.nullable(z.string()).optional(),
    name: z.nullable(z.string()).optional(),
    links: z.nullable(z.array(z.lazy(() => CreateSupportTicketConversationLinks$inboundSchema))).optional(),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.lazy(() => CreateSupportTicketConversationMessagesUserProperties$inboundSchema)).optional(),
});
/** @internal */
export const CreateSupportTicketConversationMessages$outboundSchema = z.object({
    id: z.string().optional(),
    externalId: z.nullable(z.string()).optional(),
    externalUrl: z.nullable(z.string()).optional(),
    createdAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    updatedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    role: z.string(),
    content: z.nullable(z.string()).optional(),
    name: z.nullable(z.string()).optional(),
    links: z.nullable(z.array(z.lazy(() => CreateSupportTicketConversationLinks$outboundSchema))).optional(),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.lazy(() => CreateSupportTicketConversationMessagesUserProperties$outboundSchema)).optional(),
});
export function createSupportTicketConversationMessagesToJSON(createSupportTicketConversationMessages) {
    return JSON.stringify(CreateSupportTicketConversationMessages$outboundSchema.parse(createSupportTicketConversationMessages));
}
export function createSupportTicketConversationMessagesFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateSupportTicketConversationMessages$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateSupportTicketConversationMessages' from JSON`);
}
/** @internal */
export const CreateSupportTicketConversation$inboundSchema = z.object({
    id: z.string().optional(),
    externalId: z.nullable(z.string()).optional(),
    externalUrl: z.nullable(z.string()).optional(),
    type: z.literal("support_ticket"),
    supportTicketConversationId: z.nullable(z.string()).optional(),
    createdAt: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    updatedAt: 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(() => CreateSupportTicketConversationUserProperties$inboundSchema)).optional(),
    tags: z.nullable(z.array(z.string())).optional(),
    visibility: z.nullable(CreateSupportTicketConversationVisibility$inboundSchema).optional(),
    messages: z.array(z.lazy(() => CreateSupportTicketConversationMessages$inboundSchema)),
});
/** @internal */
export const CreateSupportTicketConversation$outboundSchema = z.object({
    id: z.string().optional(),
    externalId: z.nullable(z.string()).optional(),
    externalUrl: z.nullable(z.string()).optional(),
    type: z.literal("support_ticket"),
    supportTicketConversationId: z.nullable(z.string()).optional(),
    createdAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    updatedAt: 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(() => CreateSupportTicketConversationUserProperties$outboundSchema)).optional(),
    tags: z.nullable(z.array(z.string())).optional(),
    visibility: z.nullable(CreateSupportTicketConversationVisibility$outboundSchema).optional(),
    messages: z.array(z.lazy(() => CreateSupportTicketConversationMessages$outboundSchema)),
});
export function createSupportTicketConversationToJSON(createSupportTicketConversation) {
    return JSON.stringify(CreateSupportTicketConversation$outboundSchema.parse(createSupportTicketConversation));
}
export function createSupportTicketConversationFromJSON(jsonString) {
    return safeParse(jsonString, (x) => CreateSupportTicketConversation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateSupportTicketConversation' from JSON`);
}
//# sourceMappingURL=createsupportticketconversation.js.map