'use strict';

/**
 *
 *
 * @author Mai
 * @date 2018/4/24
 * @version
 */

// 参数绑定类别
const matchType = {
    fixed_id: 1,
    node_default: 2,
    properties: 3,
    code: 4,
    non_match: 5,
}
const matchTypeStr = [];
matchTypeStr[matchType.fixed_id] = '全局匹配参数';
matchTypeStr[matchType.node_default] = '节点默认参数';
matchTypeStr[matchType.properties] = '属性匹配参数';
matchTypeStr[matchType.code] = '编号匹配参数';
matchTypeStr[matchType.non_match] = '非匹配参数';
const validMatchType = [matchType.properties, matchType.code, matchType.non_match];
const validProperties = {
    loadLength: 'loadLength',
    loadWidth: 'loadWidth'
}

// 参数取值
const matchNum = {
    total_price: 1,
    dgn_quantity1: 2,
    dgn_quantity2: 3,
    quantity: 4,
};
const matchNumStr = [];
matchNumStr[matchNum.total_price] = '合价';
matchNumStr[matchNum.dgn_quantity1] = '设计数量1';
matchNumStr[matchNum.dgn_quantity2] = '设计数量2';
matchNumStr[matchNum.quantity] = '清单数量';

// 默认全局参数
const defaultGlobalParams = [
    {
        template_id: 1,
        node_id: 0,
        param_id: 1,
        code: 'g_a',
        name: '公路基本造价',
        match_type: matchType.fixed_id,
        match_key: '10',
        match_num: matchNum.total_price,
    },{
        template_id: 1,
        node_id: 0,
        param_id: 2,
        code: 'g_b',
        name: '建安费',
        match_type: matchType.fixed_id,
        match_key: '1',
        match_num: matchNum.total_price,
    },{
        template_id: 1,
        node_id: 0,
        param_id: 3,
        code: 'g_c',
        name: '工程建设其他费用',
        match_type: matchType.fixed_id,
        match_key: '3',
        match_num: matchNum.total_price,
    },{
        template_id: 1,
        node_id: 0,
        param_id: 4,
        code: 'g_d',
        name: '路线总长度（主线长度）',
        match_type: matchType.non_match,
    },{
        template_id: 1,
        node_id: 0,
        param_id: 5,
        code: 'g_e',
        name: '建筑总面积{路线总长度（主线长度）×路基（或桥隧）宽度}',
        match_type: matchType.non_match,
    },{
        template_id: 1,
        node_id: 0,
        param_id: 6,
        code: 'g_f',
        name: '路基长度（指不含桥梁、隧道的路基长度（双幅平均计））',
        match_type: matchType.non_match,
    },
];
// 默认节点参数
const defaultNodeParams = [
    {
        template_id: 1,
        param_id: 1,
        code: 'a',
        name: '本项合价',
        match_type: matchType.node_default,
        match_num: matchNum.total_price,
    }, {
        template_id: 1,
        param_id: 2,
        code: 'b',
        name: '本项数量1',
        match_type: matchType.node_default,
        match_num: matchNum.dgn_quantity1,
    }, {
        template_id: 1,
        param_id: 3,
        code: 'c',
        name: '本项数量2',
        match_type: matchType.node_default,
        match_num: matchNum.dgn_quantity2,
    }, {
        template_id: 1,
        param_id: 4,
        code: 'd',
        name: '本项清单数量',
        match_type: matchType.node_default,
        match_num: matchNum.quantity,
    }
];

module.exports = {
    matchType,
    matchTypeStr,
    validMatchType,
    validProperties,
    matchNum,
    matchNumStr,
    defaultGlobalParams,
    defaultNodeParams
}