import { z } from "zod";

import { arrayOrEmpty } from "../../nullable-defaults";
import { ChatMessageSchema } from "../chat_message";

export const ChatPreviewItemSchema = z
  .object({
    characterId: z.string().min(1),
    message: ChatMessageSchema.nullable().default(null),
  })
  .readonly();

export const ChatPreviewsResponseSchema = z
  .object({
    items: arrayOrEmpty(ChatPreviewItemSchema),
  })
  .readonly();

export type ChatPreviewItem = z.output<typeof ChatPreviewItemSchema>;
export type ChatPreviewsResponseInput = z.input<typeof ChatPreviewsResponseSchema>;
export type ChatPreviewsResponse = z.output<typeof ChatPreviewsResponseSchema>;
