/**
 * 一键解锁历史锁定消息响应
 */
import { z } from "zod";

export const UnlockHistoryCostsByMessageSchema = z.record(z.string(), z.number());

export const UnlockHistoryReasonSchema = z.enum([
  "ok",
  "insufficient_balance",
  "no_locked_messages",
]);

export const UnlockHistoryResponseSchema = z.object({
  unlocked: z.boolean(),
  reason: UnlockHistoryReasonSchema,
  totalLocked: z.number().default(0),
  unlockedCount: z.number().default(0),
  privateCount: z.number().default(0),
  imageCount: z.number().default(0),
  voiceCount: z.number().default(0),
  requiredCredits: z.number().default(0),
  currentCredits: z.number().default(0),
  remainingCredits: z.number().default(0),
  shortfallCredits: z.number().default(0),
  costsByMessage: UnlockHistoryCostsByMessageSchema.default({}),
  messageIds: z.array(z.string()).default([]),
});

export type UnlockHistoryReason = z.output<typeof UnlockHistoryReasonSchema>;
export type UnlockHistoryResponseInput = z.input<
  typeof UnlockHistoryResponseSchema
>;
export type UnlockHistoryResponseData = z.output<
  typeof UnlockHistoryResponseSchema
>;
