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

class PromotionalGiftCharacterTrait extends Model {}

PromotionalGiftCharacterTrait.init( 
  {
    giftId: {
      type: DataTypes.INTEGER,
      field: 'gift_id',
      allowNull: false
    },
    traitId: {
      type: DataTypes.INTEGER,
      field: 'trait_id',
      allowNull: false
    },
    suitability: {
      type: DataTypes.INTEGER,
      allowNull: false,
      validate: {
        min: 1,
        max: 5}}},
  {
    sequelize,
    modelName: 'PromotionalGiftCharacterTrait',
    tableName: 'promotional_gift_character_trait',
    schema: 'falukant_predefine',
    timestamps: false,
    underscored: true,
    indexes: [
      { unique: true, fields: ['gift_id','trait_id'] }
    ]}
);
  
export default PromotionalGiftCharacterTrait;
