/**
 * 发送消息响应
 * 原始 Dart: ChatSendResponse (lib/data/models/chat/chat_response.dart)
 */
import { z } from "zod";

export const ChatBlockDetailSchema = z.object({
  type: z.string(),
  usedToday: z.number(),
  limit: z.number(),
});

export const ChatSendResponseSchema = z.object({
  mode: z.string().default(""),
  reply: z.string(),
  voiceUrl: z.string().default(""),
  audioUrl: z.string().default(""),
  intimacyChange: z.number().default(0),
  newIntimacy: z.number().default(0),
  relationshipStage: z.string(),
  currentMood: z.string().default(""),
  messageId: z.string(),
  isGuest: z.boolean().default(false),
  // 函数式 default —— 每次 parse 时重新调 Date.now()（后端不返回 timestamp 时用当下时间）
  timestamp: z.number().default(() => Date.now()),
  blocked: z.boolean().nullable().default(null),
  blockReason: z.string().nullable().default(null),
  blockDetail: ChatBlockDetailSchema.nullable().default(null),
  paywallTriggered: z.boolean().default(false),
  showUpgrade: z.boolean().default(false),
  imageType: z.string().nullable().default(null),
  imageUrl: z.string().nullable().default(null),
});

export type ChatSendResponseInput = z.input<typeof ChatSendResponseSchema>;
export type ChatSendResponseData = z.output<typeof ChatSendResponseSchema>;
export type ChatBlockDetailData = z.output<typeof ChatBlockDetailSchema>;
