/**
 * Standalone renderer for social-poster image preview.
 * Bypasses NestJS — directly instantiates ImageRendererService with a
 * sample PredictionCardDto so we can SEE what the output looks like
 * without standing up the full app.
 *
 * Usage:
 *   npx ts-node --transpile-only -r tsconfig-paths/register \
 *     src/scripts/render-social-card-sample.ts
 */

import { ImageRendererService } from "../modules/social-poster/image-renderer.service";
import { PredictionCardDto } from "../modules/social-poster/dto/prediction-card.dto";

async function main() {
  const renderer = new ImageRendererService();
  renderer.onModuleInit();

  // Sample 1: Basketball — like the user's Unicaja vs AEK reference image
  const basketCard: PredictionCardDto = {
    matchId: "sample-basket-001",
    sport: "basketball",
    homeTeam: "Unicaja Malaga",
    awayTeam: "AEK",
    homeLogo: "",
    awayLogo: "",
    leagueName: "Şampiyonlar Ligi",
    leagueLogo: "",
    countryName: "Avrupa",
    countryFlag: "",
    matchDate: "25 May 2026 - 21:00",
    htScore: "40-35",
    ftScore: "88-75",
    scoreConfidence: 90,
    topPicks: [
      {
        market: "Toplam Sayı: Üst 160.5",
        marketEn: "Total Points: Over 160.5",
        pick: "Üst",
        confidence: 85,
        odds: 1.85,
      },
      {
        market: "Ev Sahibi Toplam: Üst 82.5",
        marketEn: "Home Total: Over 82.5",
        pick: "Üst",
        confidence: 83,
        odds: 1.78,
      },
      {
        market: "Handikap: Ev Sahibi -5.5",
        marketEn: "Handicap: Home -5.5",
        pick: "1 (-5.5)",
        confidence: 78,
        odds: 1.92,
      },
    ],
    riskLevel: "LOW",
  };

  // Sample 2: Football — Süper Lig
  const footballCard: PredictionCardDto = {
    matchId: "sample-foot-001",
    sport: "football",
    homeTeam: "Galatasaray",
    awayTeam: "Fenerbahçe",
    homeLogo: "",
    awayLogo: "",
    leagueName: "Süper Lig",
    leagueLogo: "",
    countryName: "Türkiye",
    countryFlag: "",
    matchDate: "26 May 2026 - 20:00",
    htScore: "1-0",
    ftScore: "2-1",
    scoreConfidence: 72,
    topPicks: [
      {
        market: "Maç Sonucu",
        marketEn: "Match Result",
        pick: "1",
        confidence: 68,
        odds: 2.15,
      },
      {
        market: "Üst 2.5 Gol",
        marketEn: "Over 2.5",
        pick: "Üst",
        confidence: 61,
        odds: 1.92,
      },
      {
        market: "Karşılıklı Gol",
        marketEn: "Both Teams Score",
        pick: "Var",
        confidence: 58,
        odds: 1.75,
      },
    ],
    riskLevel: "MEDIUM",
  };

  console.log("Rendering basketball card...");
  const basketPath = await renderer.renderCard(basketCard);
  console.log(`  → ${basketPath}`);

  console.log("Rendering football card...");
  const footballPath = await renderer.renderCard(footballCard);
  console.log(`  → ${footballPath}`);

  console.log("\nDone. Open the JPGs to see the output:");
  console.log(`  ${basketPath}`);
  console.log(`  ${footballPath}`);
}

main().catch((err) => {
  console.error(err);
  process.exit(1);
});
