import { describe, expect, it } from "vitest";

import { CreatePaymentOrderRequestSchema } from "@/data/schemas/payment";

describe("CreatePaymentOrderRequestSchema", () => {
  const baseRequest = {
    planId: "vip_monthly",
    payChannel: "stripe",
    autoRenew: true,
  } as const;

  it("accepts a UUID chatActionId for funnel attribution", () => {
    expect(
      CreatePaymentOrderRequestSchema.parse({
        ...baseRequest,
        chatActionId: "019c8f8d-17d3-7a42-b1cc-b6927b1927d5",
      }),
    ).toMatchObject({
      ...baseRequest,
      chatActionId: "019c8f8d-17d3-7a42-b1cc-b6927b1927d5",
    });
  });

  it("rejects a non-UUID chatActionId", () => {
    expect(() =>
      CreatePaymentOrderRequestSchema.parse({
        ...baseRequest,
        chatActionId: "action-1",
      }),
    ).toThrow();
  });
});
