import { PrismaClient } from "@prisma/client";

const prisma = new PrismaClient();

const globalCurrencies = [
  ["IDR", "Indonesian Rupiah", "Mata uang default sistem."],
  ["USD", "US Dollar", "Mata uang internasional umum."],
  ["EUR", "Euro", "Mata uang utama kawasan Euro."],
  ["GBP", "British Pound Sterling", "Mata uang utama Inggris."],
  ["JPY", "Japanese Yen", "Mata uang utama Jepang."],
  ["CNY", "Chinese Yuan Renminbi", "Mata uang utama Tiongkok."],
  ["HKD", "Hong Kong Dollar", "Mata uang utama Hong Kong."],
  ["SGD", "Singapore Dollar", "Mata uang regional umum."],
  ["AUD", "Australian Dollar", "Mata uang utama Australia."],
  ["NZD", "New Zealand Dollar", "Mata uang utama Selandia Baru."],
  ["CAD", "Canadian Dollar", "Mata uang utama Kanada."],
  ["CHF", "Swiss Franc", "Mata uang utama Swiss."],
  ["SEK", "Swedish Krona", "Mata uang utama Swedia."],
  ["NOK", "Norwegian Krone", "Mata uang utama Norwegia."],
  ["DKK", "Danish Krone", "Mata uang utama Denmark."],
  ["PLN", "Polish Zloty", "Mata uang utama Polandia."],
  ["CZK", "Czech Koruna", "Mata uang utama Ceko."],
  ["HUF", "Hungarian Forint", "Mata uang utama Hungaria."],
  ["AED", "UAE Dirham", "Mata uang utama Uni Emirat Arab."],
  ["SAR", "Saudi Riyal", "Mata uang utama Arab Saudi."],
  ["QAR", "Qatari Riyal", "Mata uang utama Qatar."],
  ["KWD", "Kuwaiti Dinar", "Mata uang utama Kuwait."],
  ["BHD", "Bahraini Dinar", "Mata uang utama Bahrain."],
  ["OMR", "Omani Rial", "Mata uang utama Oman."],
  ["INR", "Indian Rupee", "Mata uang utama India."],
  ["PKR", "Pakistani Rupee", "Mata uang utama Pakistan."],
  ["BDT", "Bangladeshi Taka", "Mata uang utama Bangladesh."],
  ["KRW", "South Korean Won", "Mata uang utama Korea Selatan."],
  ["TWD", "New Taiwan Dollar", "Mata uang utama Taiwan."],
  ["THB", "Thai Baht", "Mata uang utama Thailand."],
  ["MYR", "Malaysian Ringgit", "Mata uang utama Malaysia."],
  ["PHP", "Philippine Peso", "Mata uang utama Filipina."],
  ["VND", "Vietnamese Dong", "Mata uang utama Vietnam."],
  ["KHR", "Cambodian Riel", "Mata uang utama Kamboja."],
  ["LAK", "Lao Kip", "Mata uang utama Laos."],
  ["MMK", "Myanmar Kyat", "Mata uang utama Myanmar."],
  ["ZAR", "South African Rand", "Mata uang utama Afrika Selatan."],
  ["NGN", "Nigerian Naira", "Mata uang utama Nigeria."],
  ["EGP", "Egyptian Pound", "Mata uang utama Mesir."],
  ["KES", "Kenyan Shilling", "Mata uang utama Kenya."],
  ["TRY", "Turkish Lira", "Mata uang utama Turki."],
  ["ILS", "Israeli New Shekel", "Mata uang utama Israel."],
  ["MXN", "Mexican Peso", "Mata uang utama Meksiko."],
  ["BRL", "Brazilian Real", "Mata uang utama Brasil."],
  ["ARS", "Argentine Peso", "Mata uang utama Argentina."],
  ["CLP", "Chilean Peso", "Mata uang utama Chili."],
  ["COP", "Colombian Peso", "Mata uang utama Kolombia."],
  ["PEN", "Peruvian Sol", "Mata uang utama Peru."]
];

async function main() {
  const result = await prisma.currency.createMany({
    data: globalCurrencies.map(([code, name, description]) => ({
      code,
      name,
      description,
      status: "ACTIVE"
    })),
    skipDuplicates: true
  });

  console.log(JSON.stringify({ inserted: result.count, total_candidates: globalCurrencies.length }, null, 2));
}

main()
  .catch((error) => {
    console.error(error);
    process.exitCode = 1;
  })
  .finally(async () => {
    await prisma.$disconnect();
  });
