const db = require('../config/db');

async function insertCardSetRarity(entry) {
  const { card_id, set_id, rarity_id, card_set_code } = entry;
  const sql = `
    INSERT INTO card_sets_rarity (card_id, set_id, rarity_id, card_set_code)
    VALUES (?, ?, ?, ?)
    ON DUPLICATE KEY UPDATE card_set_code = VALUES(card_set_code)
  `;
  await db.execute(sql, [card_id, set_id, rarity_id, card_set_code]);
}

module.exports = { insertCardSetRarity };