#!/usr/bin/env tsx
/**
 * 直连 MotherShip axel API 获取真实报价（完全绕过页面 widget 交互）
 *
 * 用法:
 *   npm run quote -- --origin "3131 Western Ave, West Seattle, WA 98126" --dest "123 Main St, Los Angeles, CA 90001" --pallets 2 --weight 500
 */
import { fetchAxelQuote } from "@/lib/axel/client";
import { parseQuoteCliArgs } from "@/lib/axel/parse-cli-args";

async function main(): Promise<void> {
  const input = parseQuoteCliArgs(process.argv.slice(2));
  const result = await fetchAxelQuote(input);
  console.log(JSON.stringify(result, null, 2));
}

main().catch((err: unknown) => {
  const message = err instanceof Error ? err.message : String(err);
  console.error(JSON.stringify({ error: message }));
  process.exit(1);
});
