const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
  return db.define("stpay", {
    saas_id: { type: DataTypes.STRING(32), allowNull: true, defaultValue: "", COMMENT: '订单id' },
    saas_merchant_id: { type: DataTypes.STRING(32), allowNull: true, defaultValue: "", COMMENT: '商户id, 可为空' },
    busi_name: { type: DataTypes.STRING(32), allowNull: true, defaultValue: "", COMMENT: '业务名称' },
    busi_id: { type: DataTypes.STRING(32), allowNull: true, defaultValue: "", COMMENT: '业务id' },
    pay_type: { type: DataTypes.INTEGER, allowNull: true, defaultValue: "1", COMMENT: '支付类型 1线下支付 2...' },
    amount: { type: DataTypes.BIGINT, allowNull: true, defaultValue: "0", COMMENT: '支付金额' },
    pay_status: { type: DataTypes.STRING(4), allowNull: true, defaultValue: "", COMMENT: '支付状态 10待支付 20已支付' },
    pay_voucher_img: { type: DataTypes.STRING(300), allowNull: true, defaultValue: "", COMMENT: '支付凭证' },
    trade_no: { type: DataTypes.STRING(64), allowNull: true, defaultValue: "", COMMENT: '交易流水号' }
  }, {
    paranoid: true, //假的删除
    underscored: true,
    version: true,
    freezeTableName: true,
    //freezeTableName: true,
    // define the table's name
    tableName: 'st_pay',
    validate: {},
    indexes: [
      // Create a unique index on email
      //  {
      //    unique: true,
      //    fields: ['email']
      //  },
      //
      //  // Creates a gin index on data with the jsonb_path_ops operator
      //  {
      //    fields: ['data'],
      //    using: 'gin',
      //    operator: 'jsonb_path_ops'
      //  },
      //
      //  // By default index name will be [table]_[fields]
      //  // Creates a multi column partial index
      //  {
      //    name: 'public_by_author',
      //    fields: ['author', 'status'],
      //    where: {
      //      status: 'public'
      //    }
      //  },
      //
      //  // A BTREE index with a ordered field
      //  {
      //    name: 'title_index',
      //    method: 'BTREE',
      //    fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
      //  }
    ],
  });
}