const { DataTypes } = require('sequelize');
const sequelize = require('../db');

const Character = sequelize.define('character', {
  telegram_id: {
    type: DataTypes.BIGINT,
    primaryKey: true,
    unique: true,
  },
  username: { 
    type: DataTypes.STRING 
  },
  name: { 
    type: DataTypes.STRING 
  },
  level: { 
    type: DataTypes.INTEGER, 
    defaultValue: 1 
  },
  exp: { 
    type: DataTypes.INTEGER, 
    defaultValue: 0 
  },
  firePoints: { 
    type: DataTypes.INTEGER, 
    defaultValue: 0 
  },
  hp: { 
    type: DataTypes.INTEGER, 
    defaultValue: 100 
  },
  max_hp: { 
    type: DataTypes.INTEGER, 
    defaultValue: 100 
  },
  armor: { 
    type: DataTypes.INTEGER, 
    defaultValue: 0 
  },
  stamina: { 
    type: DataTypes.INTEGER, 
    defaultValue: 100 
  },
  max_stamina: { 
    type: DataTypes.INTEGER, 
    defaultValue: 100 
  },
  force: { 
    type: DataTypes.INTEGER, 
    defaultValue: 1 
  },
  intelligence: { 
    type: DataTypes.INTEGER, 
    defaultValue: 1 
  },
  resilience: { 
    type: DataTypes.INTEGER, 
    defaultValue: 1 
  },
  endurance: { 
    type: DataTypes.INTEGER, 
    defaultValue: 1 
  },
  dirtymoney: { 
    type: DataTypes.INTEGER, 
    defaultValue: 0 
  },
  stealedcards: { 
    type: DataTypes.INTEGER, 
    defaultValue: 0 
  },
  shoprobcd: { 
    type: DataTypes.INTEGER, 
    defaultValue: 0 
  },
  pocketstealcd: { 
    type: DataTypes.INTEGER, 
    defaultValue: 0 
  },
  activeEffects: { type: DataTypes.JSON, allowNull: true, defaultValue: [] },
  equippedItems: { type: DataTypes.ARRAY(DataTypes.INTEGER), allowNull: true, defaultValue: [] },
});

module.exports = Character;
