const Sequelize = require("sequelize");

module.exports = (db) => {
  const biz_usage_monthly = db.define(
    "biz_usage_monthly",
    {
  
      user_id: {
        type: Sequelize.BIGINT.UNSIGNED,
        allowNull: false,
      },
      plan_id: {
        type: Sequelize.BIGINT.UNSIGNED,
        allowNull: false,
      },
      stat_month: {
        type: Sequelize.STRING(7),
        allowNull: false,
      },
      msg_count: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 },
      mass_count: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 },
      friend_count: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 },
      sns_count: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 },
      active_user_count: { type: Sequelize.INTEGER, allowNull: false, defaultValue: 0 },
      api_call_count: {
        type: Sequelize.INTEGER,
        allowNull: false,
        defaultValue: 0,
      },
    },
    {
      tableName: "biz_usage_monthly",
      freezeTableName: true,
      timestamps: false,
      underscored: true,
    }
  );
  // biz_usage_monthly.sync({ alter: true });
  return biz_usage_monthly;
};
