35 lines
914 B
TypeScript
35 lines
914 B
TypeScript
/**
|
|
* Chat wire payload fragments shared by send response and history messages.
|
|
*/
|
|
import { z } from "zod";
|
|
|
|
import { booleanOrFalse, schemaOr, stringOrNull } from "../nullable-defaults";
|
|
|
|
const CHAT_IMAGE_DEFAULTS = { type: null, url: null } as const;
|
|
|
|
const CHAT_LOCK_DETAIL_DEFAULTS = {
|
|
locked: false,
|
|
reason: null,
|
|
} as const;
|
|
|
|
export const ChatImageSchema = schemaOr(
|
|
z.object({
|
|
type: stringOrNull,
|
|
url: stringOrNull,
|
|
}),
|
|
CHAT_IMAGE_DEFAULTS,
|
|
).readonly();
|
|
|
|
export const ChatLockDetailSchema = schemaOr(
|
|
z.object({
|
|
locked: booleanOrFalse,
|
|
reason: stringOrNull,
|
|
}),
|
|
CHAT_LOCK_DETAIL_DEFAULTS,
|
|
).readonly();
|
|
|
|
export type ChatImageInput = z.input<typeof ChatImageSchema>;
|
|
export type ChatImageData = z.output<typeof ChatImageSchema>;
|
|
export type ChatLockDetailInput = z.input<typeof ChatLockDetailSchema>;
|
|
export type ChatLockDetailData = z.output<typeof ChatLockDetailSchema>;
|