/*
 * 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 Type = {
    Positive: "positive",
    Negative: "negative",
};
export const LogFeedbackType = {
    Positive: "positive",
    Negative: "negative",
    New: "new",
};
export const LogFeedbackFeedbackType = {
    Positive: "positive",
    Negative: "negative",
};
export const LogFeedbackFeedbackResponseType = {
    Positive: "positive",
    Negative: "negative",
    New: "new",
};
/** @internal */
export const Type$inboundSchema = z.nativeEnum(Type);
/** @internal */
export const Type$outboundSchema = Type$inboundSchema;
/** @internal */
export const Reasons$inboundSchema = z.object({
    label: z.string(),
    details: z.string(),
});
/** @internal */
export const Reasons$outboundSchema = z.object({
    label: z.string(),
    details: z.string(),
});
export function reasonsToJSON(reasons) {
    return JSON.stringify(Reasons$outboundSchema.parse(reasons));
}
export function reasonsFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Reasons$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Reasons' from JSON`);
}
/** @internal */
export const Id$inboundSchema = z.union([
    z.string(),
    z.number(),
]);
/** @internal */
export const Id$outboundSchema = z
    .union([z.string(), z.number()]);
export function idToJSON(id) {
    return JSON.stringify(Id$outboundSchema.parse(id));
}
export function idFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Id$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Id' from JSON`);
}
/** @internal */
export const UserId$inboundSchema = z
    .union([z.string(), z.number()]);
/** @internal */
export const UserId$outboundSchema = z.union([z.string(), z.number()]);
export function userIdToJSON(userId) {
    return JSON.stringify(UserId$outboundSchema.parse(userId));
}
export function userIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => UserId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UserId' from JSON`);
}
/** @internal */
export const UserProperties$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 UserProperties$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 userPropertiesToJSON(userProperties) {
    return JSON.stringify(UserProperties$outboundSchema.parse(userProperties));
}
export function userPropertiesFromJSON(jsonString) {
    return safeParse(jsonString, (x) => UserProperties$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UserProperties' from JSON`);
}
/** @internal */
export const LogFeedbackType$inboundSchema = z.nativeEnum(LogFeedbackType);
/** @internal */
export const LogFeedbackType$outboundSchema = LogFeedbackType$inboundSchema;
/** @internal */
export const Sources$inboundSchema = z.object({
    type: z.nullable(LogFeedbackType$inboundSchema),
    title: z.nullable(z.string()).optional(),
    url: z.nullable(z.string()).optional(),
});
/** @internal */
export const Sources$outboundSchema = z.object({
    type: z.nullable(LogFeedbackType$outboundSchema),
    title: z.nullable(z.string()).optional(),
    url: z.nullable(z.string()).optional(),
});
export function sourcesToJSON(sources) {
    return JSON.stringify(Sources$outboundSchema.parse(sources));
}
export function sourcesFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Sources$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Sources' from JSON`);
}
/** @internal */
export const LogFeedbackRequestBody$inboundSchema = z.object({
    id: z.string().optional(),
    type: Type$inboundSchema,
    messageId: z.string(),
    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(),
    reasons: z.nullable(z.array(z.lazy(() => Reasons$inboundSchema))).optional(),
    details: z.nullable(z.string()).optional(),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.lazy(() => UserProperties$inboundSchema))
        .optional(),
    sources: z.nullable(z.array(z.lazy(() => Sources$inboundSchema))).optional(),
});
/** @internal */
export const LogFeedbackRequestBody$outboundSchema = z.object({
    id: z.string().optional(),
    type: Type$outboundSchema,
    messageId: z.string(),
    createdAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    updatedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    reasons: z.nullable(z.array(z.lazy(() => Reasons$outboundSchema))).optional(),
    details: z.nullable(z.string()).optional(),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.lazy(() => UserProperties$outboundSchema))
        .optional(),
    sources: z.nullable(z.array(z.lazy(() => Sources$outboundSchema))).optional(),
});
export function logFeedbackRequestBodyToJSON(logFeedbackRequestBody) {
    return JSON.stringify(LogFeedbackRequestBody$outboundSchema.parse(logFeedbackRequestBody));
}
export function logFeedbackRequestBodyFromJSON(jsonString) {
    return safeParse(jsonString, (x) => LogFeedbackRequestBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LogFeedbackRequestBody' from JSON`);
}
/** @internal */
export const LogFeedbackFeedbackType$inboundSchema = z.nativeEnum(LogFeedbackFeedbackType);
/** @internal */
export const LogFeedbackFeedbackType$outboundSchema = LogFeedbackFeedbackType$inboundSchema;
/** @internal */
export const LogFeedbackReasons$inboundSchema = z.object({
    label: z.string(),
    details: z.string(),
});
/** @internal */
export const LogFeedbackReasons$outboundSchema = z.object({
    label: z.string(),
    details: z.string(),
});
export function logFeedbackReasonsToJSON(logFeedbackReasons) {
    return JSON.stringify(LogFeedbackReasons$outboundSchema.parse(logFeedbackReasons));
}
export function logFeedbackReasonsFromJSON(jsonString) {
    return safeParse(jsonString, (x) => LogFeedbackReasons$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LogFeedbackReasons' from JSON`);
}
/** @internal */
export const LogFeedbackId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const LogFeedbackId$outboundSchema = z.union([z.string(), z.number()]);
export function logFeedbackIdToJSON(logFeedbackId) {
    return JSON.stringify(LogFeedbackId$outboundSchema.parse(logFeedbackId));
}
export function logFeedbackIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => LogFeedbackId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LogFeedbackId' from JSON`);
}
/** @internal */
export const LogFeedbackUserId$inboundSchema = z.union([z.string(), z.number()]);
/** @internal */
export const LogFeedbackUserId$outboundSchema = z.union([z.string(), z.number()]);
export function logFeedbackUserIdToJSON(logFeedbackUserId) {
    return JSON.stringify(LogFeedbackUserId$outboundSchema.parse(logFeedbackUserId));
}
export function logFeedbackUserIdFromJSON(jsonString) {
    return safeParse(jsonString, (x) => LogFeedbackUserId$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LogFeedbackUserId' from JSON`);
}
/** @internal */
export const LogFeedbackUserProperties$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 LogFeedbackUserProperties$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 logFeedbackUserPropertiesToJSON(logFeedbackUserProperties) {
    return JSON.stringify(LogFeedbackUserProperties$outboundSchema.parse(logFeedbackUserProperties));
}
export function logFeedbackUserPropertiesFromJSON(jsonString) {
    return safeParse(jsonString, (x) => LogFeedbackUserProperties$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LogFeedbackUserProperties' from JSON`);
}
/** @internal */
export const LogFeedbackFeedbackResponseType$inboundSchema = z.nativeEnum(LogFeedbackFeedbackResponseType);
/** @internal */
export const LogFeedbackFeedbackResponseType$outboundSchema = LogFeedbackFeedbackResponseType$inboundSchema;
/** @internal */
export const LogFeedbackSources$inboundSchema = z.object({
    type: z.nullable(LogFeedbackFeedbackResponseType$inboundSchema),
    title: z.nullable(z.string()).optional(),
    url: z.nullable(z.string()).optional(),
});
/** @internal */
export const LogFeedbackSources$outboundSchema = z.object({
    type: z.nullable(LogFeedbackFeedbackResponseType$outboundSchema),
    title: z.nullable(z.string()).optional(),
    url: z.nullable(z.string()).optional(),
});
export function logFeedbackSourcesToJSON(logFeedbackSources) {
    return JSON.stringify(LogFeedbackSources$outboundSchema.parse(logFeedbackSources));
}
export function logFeedbackSourcesFromJSON(jsonString) {
    return safeParse(jsonString, (x) => LogFeedbackSources$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LogFeedbackSources' from JSON`);
}
/** @internal */
export const LogFeedbackResponseBody$inboundSchema = z.object({
    id: z.string(),
    type: LogFeedbackFeedbackType$inboundSchema,
    messageId: z.string(),
    createdAt: z.string(),
    updatedAt: z.string(),
    reasons: z.nullable(z.array(z.lazy(() => LogFeedbackReasons$inboundSchema)))
        .optional(),
    details: z.nullable(z.string()).optional(),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.lazy(() => LogFeedbackUserProperties$inboundSchema)).optional(),
    sources: z.nullable(z.array(z.lazy(() => LogFeedbackSources$inboundSchema)))
        .optional(),
});
/** @internal */
export const LogFeedbackResponseBody$outboundSchema = z.object({
    id: z.string(),
    type: LogFeedbackFeedbackType$outboundSchema,
    messageId: z.string(),
    createdAt: z.string(),
    updatedAt: z.string(),
    reasons: z.nullable(z.array(z.lazy(() => LogFeedbackReasons$outboundSchema)))
        .optional(),
    details: z.nullable(z.string()).optional(),
    properties: z.nullable(z.record(z.any())).optional(),
    userProperties: z.nullable(z.lazy(() => LogFeedbackUserProperties$outboundSchema)).optional(),
    sources: z.nullable(z.array(z.lazy(() => LogFeedbackSources$outboundSchema)))
        .optional(),
});
export function logFeedbackResponseBodyToJSON(logFeedbackResponseBody) {
    return JSON.stringify(LogFeedbackResponseBody$outboundSchema.parse(logFeedbackResponseBody));
}
export function logFeedbackResponseBodyFromJSON(jsonString) {
    return safeParse(jsonString, (x) => LogFeedbackResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LogFeedbackResponseBody' from JSON`);
}
//# sourceMappingURL=logfeedback.js.map