const Sequelize = require("sequelize");

module.exports = (db) => {
  return db.define(
    "biz_user",
    {
      id: {
        type: Sequelize.BIGINT.UNSIGNED,
        primaryKey: true,
        autoIncrement: true,
      },
      name: {
        type: Sequelize.STRING(100),
        allowNull: false,
        defaultValue: "",
        comment: "姓名/称呼",
      },
      mobile: {
        type: Sequelize.STRING(20),
        allowNull: true,
        comment: "手机号",
      },
      email: {
        type: Sequelize.STRING(120),
        allowNull: true,
      },
      company_name: {
        type: Sequelize.STRING(200),
        allowNull: true,
        comment: "公司名",
      },
      status: {
        type: Sequelize.ENUM("active", "disabled"),
        allowNull: false,
        defaultValue: "active",
      },
    },
    {
      tableName: "biz_users",
      timestamps: true,
      underscored: true,
      comment: "业务用户",
    }
  );
};
