/**
 * Created by zhang on 2018/7/13.
 */
import mongoose from "mongoose";
let Schema = mongoose.Schema;

let collectionName = 'std_bills_template_items';

// 标记字段
let flagsSchema = new Schema({
    fieldName: String,
    flag: Number
});
let BillsTemplateSchema = {
    // 树结构所需ID
    ID: Number,
    ParentID: Number,
    NextSiblingID: Number,
    // 编号
    code: String,
    // 名称
    name: String,
    // 单位
    unit: String,
    // 类别
    type: Number,
    // 标记
    flags:{
        type: [flagsSchema],
        default: []
    },
    // 所属模板库ID
    libID: {type:String,index:true},
    //计算基数
    calcBase: String,
    //费率ID
    feeRateID:Number,
    quantity: String,
};

mongoose.model(collectionName, new Schema(BillsTemplateSchema, {versionKey: false, collection: collectionName}));

