/* eslint-disable */
module.exports = {
  async up(queryInterface, Sequelize) {
    // Idempotentes Seed: legt Ruf-Aktionen an bzw. aktualisiert sie anhand "tr"
    await queryInterface.sequelize.query(`
      INSERT INTO falukant_type.reputation_action
        (tr, cost, base_gain, decay_factor, min_gain, decay_window_days)
      VALUES
        ('soup_kitchen',      500,   2, 0.85, 0, 7),
        ('library_donation',  5000,  4, 0.88, 0, 7),
        ('well_build',        8000,  4, 0.87, 0, 7),
        ('scholarships',      10000, 5, 0.87, 0, 7),
        ('church_hospice',    12000, 5, 0.87, 0, 7),
        ('school_funding',    15000, 6, 0.88, 0, 7),
        ('orphanage_build',   20000, 7, 0.90, 0, 7),
        ('bridge_build',      25000, 7, 0.90, 0, 7),
        ('hospital_donation', 30000, 8, 0.90, 0, 7),
        ('patronage',         40000, 9, 0.91, 0, 7),
        ('statue_build',      50000, 10, 0.92, 0, 7)
      ON CONFLICT (tr) DO UPDATE SET
        cost = EXCLUDED.cost,
        base_gain = EXCLUDED.base_gain,
        decay_factor = EXCLUDED.decay_factor,
        min_gain = EXCLUDED.min_gain,
        decay_window_days = EXCLUDED.decay_window_days;
    `);
  },

  async down(queryInterface, Sequelize) {
    // Entfernt nur die gesetzten Seeds (tr-basiert)
    await queryInterface.sequelize.query(`
      DELETE FROM falukant_type.reputation_action
      WHERE tr IN (
        'soup_kitchen',
        'library_donation',
        'well_build',
        'scholarships',
        'church_hospice',
        'school_funding',
        'orphanage_build',
        'bridge_build',
        'hospital_donation',
        'patronage',
        'statue_build'
      );
    `);
  },
};


