/**
 * 计价规则数据结构
 *
 * @author CaiAoLin
 * @date 2017/8/31
 * @version
 */
const mongoose = require('mongoose');

let Schema = mongoose.Schema;
let collectionName = 'engineering_lib';
let taxGroupSchema = new  Schema({
    taxType: String,//计税方式
    program_lib: { type: Schema.Types.Mixed,default:{}},// 计算程序标准库
    template_lib:{ type: Schema.Types.Mixed,default:{}},//清单模板库
    col_lib:{ type: Schema.Types.Mixed,default:{}},
    fee_lib:{ type: Schema.Types.Mixed,default:{}}//费率标准库
},{_id: false});

let modelSchema = {
    // 标准清单
    bill_lib: {
        type: Schema.Types.Mixed,
        default: []
    },
    // 定额库
    ration_lib: {
        type: Schema.Types.Mixed,
        default: []
    },
    // 工料机库
    glj_lib: {
        type: Schema.Types.Mixed,
        default: []
    },
    //清单指引库
    billsGuidance_lib: {
        type: Schema.Types.Mixed,
        default: []
    },
    tax_group :{
        type: [taxGroupSchema],
        default: []
    },
   /* // 费率标准库
    fee_lib: {
        type: Schema.Types.Mixed,
        default: []
    },*/
    // 人工系数标准库
    artificial_lib: {
        type: Schema.Types.Mixed,
        default: []
    },
    //工程特征库
    feature_lib:{
        type: Schema.Types.Mixed,
        default: []
    },
    //基本信息库
    info_lib: {
        type: Schema.Types.Mixed,
        default: []
    },
    engineer_info_lib: {
        type: Schema.Types.Mixed,
        default: []
    },
    //工程特征指标库
    engineer_feature_lib: {
        type: Schema.Types.Mixed,
        default: []
    },
    //主要工料指标库
    material_lib: {
        type: Schema.Types.Mixed,
        default: []
    },
    //主要工程量指标库
    main_quantity_lib: {
        type: Schema.Types.Mixed,
        default: []
    },
    //主要经济指标库
    economic_lib: {
        type: Schema.Types.Mixed,
        default: []
    },
    //超高降效库
    over_height_lib: {
        type: Schema.Types.Mixed,
        default: []
    },
    //设置人材机显示列
    glj_col:{
        showAdjustPrice:Boolean//是否显示调整价列
    },
    //清单或定额计价规则ID
    valuationID:{type:String,index: true},
    //工程专业名称
    name:String,
    //费用标准
    feeName:String,
    //前端是否显示
    visible:{type: Boolean, default: false},
    //取费专业
    engineering:Number,
    //是否计算安装增加费
    isInstall:{type: Boolean, default: false},
    //是否计算子目增加费
    isItemIncrease:{type: Boolean, default: false},
    //是否计算面积增加费
    isAreaIncrease:{type: Boolean, default: false},
    indexName:String,//指标专业名称
    seq:Number//序列号
};
mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));

