import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
import PromotionalGift from '../type/promotional_gift.js';
import Mood from '../type/mood.js';

class PromotionalGiftMood extends Model {}

PromotionalGiftMood.init(
  {
    giftId: {
      type: DataTypes.INTEGER,
      field: 'gift_id',
      allowNull: false
    },
    moodId: {
      type: DataTypes.INTEGER,
      field: 'mood_id',
      allowNull: false
    },
    suitability: {
      type: DataTypes.INTEGER,
      allowNull: false,
      validate: {
        min: 1,
        max: 5}}},
  {
    sequelize,
    modelName: 'PromotionalGiftMood', 
    tableName: 'promotional_gift_mood',
    schema: 'falukant_predefine',
    timestamps: false,
    underscored: true,
    indexes: [
      {
        unique: true,
        fields: ['gift_id', 'mood_id']
      }
    ]
  }
);

export default PromotionalGiftMood;
