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

const Battle = sequelize.define('battle', {
  id: {
    type: DataTypes.INTEGER,
    autoIncrement: true,
    primaryKey: true,
  },
  enemy: {
    type: DataTypes.INTEGER,
    allowNull: true,
  },
  location: {
    type: DataTypes.INTEGER,
    allowNull: true,
  },
  character: {
    type: DataTypes.BIGINT,
    allowNull: true,
  },
  enemy_hp: { 
    type: DataTypes.INTEGER,
    allowNull: true,
  },
  status: {
    type: DataTypes.STRING,
    allowNull: false,
    defaultValue: "inactive"
  },
  logs: {
    type: DataTypes.ARRAY(DataTypes.STRING),
    allowNull: true,
    defaultValue: []
  },
});

module.exports = Battle;
