import {LogCurve} from '@int/geotoolkit/welllog/LogCurve';
import {MathUtil} from '@int/geotoolkit/util/MathUtil';
import {LogData} from '@int/geotoolkit/welllog/data/LogData';
import curveData from './curves.json';

const getCurveData = (mnemonic) => curveData[mnemonic];

const createCurve = (from, step, curveMnemonic, color) => {
  const values = curveData[curveMnemonic];
  const depths = values.map((v, i) => (from + i * step));
  const data = new LogData(depths, values);
  const limits = MathUtil.calculateNeatLimits(data.getMinValue(), data.getMaxValue(), false, false);
  return new LogCurve(data)
    .setName(curveMnemonic)
    .setNormalizationLimits(limits)
    .setLineStyle(color);
};
export {getCurveData, createCurve, curveData};

