const system = require("../../../system");
const settings = require("../../../../config/settings");
const appconfig = system.getSysConfig();
/**
 * 表单信息表
 */
module.exports = (db, DataTypes) => {
    return db.define("product", {
        code: {
            type: DataTypes.STRING
        },
        is_enabled: {
            type: DataTypes.INTEGER
        },
        name: {
            type: DataTypes.STRING
        },
        company_id: {
            type: DataTypes.INTEGER
        },
        product_type_code: {
            type: DataTypes.STRING
        },
        product_type_id: {
            type: DataTypes.INTEGER
        },
        sales_volume: {
            type: DataTypes.INTEGER
        },
        product_type_name: {
            type: DataTypes.STRING
        },
        selling_point: {
            type: DataTypes.STRING
        },
        price_type: {
            type: DataTypes.INTEGER
        },
        price: {
            type: DataTypes.INTEGER
        },
        product_detail_url: {
            type: DataTypes.STRING
        },
        list_thumbnail_url: {
            type: DataTypes.STRING
        },
        is_recommend: {
            type: DataTypes.INTEGER
        },
        service_Introduction_info: {
            type: DataTypes.TEXT
        },
        process_flow_info: {
            type: DataTypes.TEXT
        },
        information_required_info: {
            type: DataTypes.TEXT
        },
        can_get_info: {
            type: DataTypes.TEXT
        },
        our_advantage_info: {
            type: DataTypes.TEXT
        },
    },
        {
            paranoid: true,//假的删除
            underscored: true,
            version: true,
            freezeTableName: true,
            //freezeTableName: true,
            // define the table's name
            tableName: 'mc_product',
            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}]
                //  }
            ]
        });
}

