import { z } from "zod";

import { booleanOrFalse, numberOrZero, stringOrEmpty } from "../nullable-defaults";
import { ChatLockDetailSchema } from "./chat_payloads";

/**
 * 单条历史付费 / 私密消息解锁响应。
 */
export const UnlockPrivateReasonSchema = stringOrEmpty;

export const UnlockPrivateResponseSchema = z.object({
  unlocked: booleanOrFalse,
  content: stringOrEmpty,
  reason: UnlockPrivateReasonSchema,
  creditBalance: numberOrZero,
  creditsCharged: numberOrZero,
  requiredCredits: numberOrZero,
  shortfallCredits: numberOrZero,
  lockDetail: ChatLockDetailSchema,
});

export type UnlockPrivateReason = z.output<typeof UnlockPrivateReasonSchema>;
export type UnlockPrivateResponseInput = z.input<
  typeof UnlockPrivateResponseSchema
>;
export type UnlockPrivateResponseData = z.output<
  typeof UnlockPrivateResponseSchema
>;
