import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
import ProductType from './product.js';
import WeatherType from './weather.js';

class ProductWeatherEffect extends Model {}

ProductWeatherEffect.init(
  {
    productId: {
      type: DataTypes.INTEGER,
      allowNull: false
    },
    weatherTypeId: {
      type: DataTypes.INTEGER,
      allowNull: false
    },
    qualityEffect: {
      type: DataTypes.INTEGER,
      allowNull: false,
      comment: 'Effekt auf Qualität: -2 (sehr negativ), -1 (negativ), 0 (neutral), 1 (positiv), 2 (sehr positiv)'
    }
  },
  {
    sequelize,
    modelName: 'ProductWeatherEffect',
    tableName: 'product_weather_effect',
    schema: 'falukant_type',
    timestamps: false,
    underscored: true,
    indexes: [
      {
        unique: true,
        fields: ['product_id', 'weather_type_id']
      }
    ]
  }
);

export default ProductWeatherEffect;

