"use server";

import { getLiuyaoAnswer } from "@/app/actions/liuyao";

/** 兼容旧版 divination 组件签名 */
export async function getAnswer(
  prompt: string,
  guaMark: string,
  guaTitle: string,
  guaResult: string,
  guaChange: string,
) {
  const now = new Date();
  const calcDate = now.toISOString().slice(0, 10);
  const calcTime = `${now.getHours().toString().padStart(2, "0")}:${now.getMinutes().toString().padStart(2, "0")}`;

  return getLiuyaoAnswer({
    question: prompt,
    calcDate,
    calcTime,
    locationName: "未指定",
    longitude: 120,
    guaMark,
    guaTitle,
    guaResult,
    guaChange,
  });
}
