import debug from 'debug';
const warn = debug('@modusjs/convert#labs:warn');
const mappings = {
    'id code': 'LabReportID',
    'grower name': 'Grower',
    'account name': 'ClientCompany',
    'Field ID': 'Field',
    'Grid': undefined,
    'Lab Number': 'SampleNumber',
    'Field Desc': 'FieldName',
    'Date Tested': ['ReportDate', 'DateReceived'],
    'Crop': undefined,
    'YLDGOAL': undefined,
    'depth range': 'StartingDepth',
    'OTHER ID#': undefined,
};
// Make this as generic as possible so as to work on other labs
const depthInfo = function (row) {
    let obj = {};
    // if we do this match, it'll allow someone to append units afterward
    // and generically find it and attempt this
    let match = Object.keys(row).find(k => /^Depth/.test(k));
    if (!match) {
        warn(`Depth info could not be found`);
        return undefined;
        //throw new Error('Depth info could not be found')
    }
    let value = row[match].toString();
    if (value.match(' to ')) {
        obj.StartingDepth = +value.split(' to ')[0];
        obj.EndingDepth = +value.split(' to ')[1];
        obj.ColumnDepth = obj.EndingDepth - obj.StartingDepth;
        obj.Name = value;
        obj.DepthUnit = 'cm';
    }
    return obj;
};
const config = {
    name: 'Soiltest Farm Consultants, Inc. - Moses Lake, WA',
    type: 'Soil',
    mappings,
    //depthInfo,
    examplesKey: 'soiltestfarmconsultants'
};
export default config;
//# sourceMappingURL=soiltestfarmconsultants.js.map