import assert from "node:assert/strict";
import test from "node:test";
import {
  applicantProfileSchema,
  emptyProfile,
  modelChatResponseSchema,
} from "@/lib/mortgage/schema";

test("emptyProfile has null intent", () => {
  assert.equal(emptyProfile().intent, null);
});

test("applicantProfileSchema accepts a full-ish profile", () => {
  const parsed = applicantProfileSchema.parse({
    intent: "mortgage_protection",
    age: 40,
    disease_screens: { diabetes: "yes" },
    coverage_on_whom: "primary",
    decision_result: {
      offer_family: "si_level",
      reasons: ["ok"],
      drivers: [],
      suggested_next_step: "agent",
    },
  });
  assert.equal(parsed.age, 40);
});

test("modelChatResponseSchema defaults patch", () => {
  const parsed = modelChatResponseSchema.parse({ reply_to_customer: "Hi" });
  assert.equal(parsed.reply_to_customer, "Hi");
  assert.deepEqual(parsed.profile_patch, {});
});
