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

const Player = sequelize.define("Player", {
  id: {
    type: DataTypes.STRING,
    primaryKey: true,
  },
  username: {
    type: DataTypes.STRING,
    allowNull: false,
  },
  level: {
    type: DataTypes.INTEGER,
    defaultValue: 1,
  },
  experience: {
    type: DataTypes.INTEGER,
    defaultValue: 0,
  },
  credits: {
    type: DataTypes.INTEGER,
    defaultValue: 500,
  },
  lastCreditUpdate: {
    type: DataTypes.DATE,
    defaultValue: DataTypes.NOW,
  },
  energy: {
    type: DataTypes.INTEGER,
    defaultValue: 100,
  },
  maxEnergy: {
    type: DataTypes.INTEGER,
    defaultValue: 100,
  },
  lastEnergyRegen: {
    type: DataTypes.DATE,
    defaultValue: DataTypes.NOW,
  },
  lastLogin: {
    type: DataTypes.DATE,
    defaultValue: DataTypes.NOW,
  },

  equipped_personal_helmet: { type: DataTypes.STRING },
  equipped_personal_suit: { type: DataTypes.STRING },
  equipped_personal_gloves: { type: DataTypes.STRING },
  equipped_personal_backpack: { type: DataTypes.STRING },
  equipped_personal_boots: { type: DataTypes.STRING },
  equipped_personal_weapons: { type: DataTypes.STRING },

  equipped_personal_accessory_1: { type: DataTypes.STRING },
  equipped_personal_accessory_2: { type: DataTypes.STRING },

  equipped_ship_hull: { type: DataTypes.STRING },
  equipped_ship_shields: { type: DataTypes.STRING },
  equipped_ship_engines: { type: DataTypes.STRING },
  equipped_ship_weapon_1: { type: DataTypes.STRING },
  equipped_ship_weapon_2: { type: DataTypes.STRING },
});

module.exports = Player;
