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

import { arrayOrEmpty, booleanOrFalse, numberOrZero, recordOrEmpty } from "../nullable-defaults";

export const UnlockHistoryCostsByMessageSchema = recordOrEmpty(z.number());

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

export const UnlockHistoryResponseSchema = z.object({
  unlocked: booleanOrFalse,
  reason: UnlockHistoryReasonSchema,
  totalLocked: numberOrZero,
  unlockedCount: numberOrZero,
  privateCount: numberOrZero,
  imageCount: numberOrZero,
  voiceCount: numberOrZero,
  requiredCredits: numberOrZero,
  currentCredits: numberOrZero,
  remainingCredits: numberOrZero,
  shortfallCredits: numberOrZero,
  costsByMessage: UnlockHistoryCostsByMessageSchema,
  messageIds: arrayOrEmpty(z.string()),
});

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