import {ImagePattern} from '@int/geotoolkit/attributes/ImagePattern';
import {LogCurve} from '@int/geotoolkit/welllog/LogCurve';

export const patterns = {
  'chert': new ImagePattern({
    'url': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAArCAYAAADMr156AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAs' +
      'TAAALEwEAmpwYAAAAB3RJTUUH3QYUEws07m+gbgAAAWBJREFUaN7tWkmOwzAMk4xe+6T+/yl9BucyBbokqS2RRoyKQE5NCEbWnpoVaMCC3B+' +
      '87cSCMfMAG5EMi3jFpuaWEPH4zf8v5ss9c48ao+feD80XwikgaAR0GBAiA797he/dDKFbKrjxdg2jTYxRdfKLhtLLg99EO/n01Lxs7kKh8OP' +
      'IJJQVk96u5kYyZLh+H3CGS2FEcyPWel9wQvUjj4i01y4QrOLGt9AYnSQ9EMMgeplMM3ZmAqb7qnjT3JcJlQDiPIHTE548URYKhTmA6bbYmKW' +
      'ZucVeJSFu8jG+ayhmgpGukqLZE2KQmGZV3BFeMzPveWD5EbsHbaJbZj4IjXoCGIZQt8bqalClcQJ3oVD40fzBWucz+wIV7yE3Y53P7gmc/PJ' +
      'dmhnr/J4GLOLuvY0dEuGxuc6PNFCjXSh7iz3K6z3cqk2zkjv9T5mRFptphLtwpKZphtAbbmZ2FZbDtOY/E/yf/j6LFtEAAAAASUVORK5CYII='
  }),
  'lime': new ImagePattern({
    'url': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAAvCAYAAACv3uebAAAAlElEQVR42u3YsRHAIAgAQPZfmmyQFMQI5r2' +
      'zpXgFwYj7lVFfXWKU4qX9uPeczKk3DhIkSOV4CnOhcEshKQQJEqSmSF6vhWNJHnZjl8SFBEnH/WpN8sJpAyBB+jqewjzkjzs7plG3tIQE6Sd' +
      'ICrM/bj0SJEjDkBRm37d740KCBAmSscRYopmEBAmSwmws0SdBgjQJ6QIsZSYFfMD7UAAAAABJRU5ErkJggg=='
  }),
  'shale': new ImagePattern({
    'url': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAAAvCAYAAACrKzemAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAs' +
      'TAAALEwEAmpwYAAAAB3RJTUUH3QYUESkalo8/7wAAAJNJREFUaN7t1zEOgDAMQ1G3979zGdgBNQUJeH+NlMGKkzhJRo6p1D/VuxPntD5M0oR' +
      'YPbgMsYh1n1iuYeEagg3XwIZsyIbEerNY4o64s2ayWrFHm6xV64/37kUxLHjIhp5SNpQN2ZANQSzZUDb8yXU0WRB3/FleB3GHDdkQxBJ3PKX' +
      'ijsmy4EEsQdoHLxuaLAseOxs2Zp+50y/6bgAAAABJRU5ErkJggg=='
  }),
  'salt': new ImagePattern({
    'url': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEkAAAAvCAYAAACv3uebAAAAdElEQVR42u3UMQoAMQgEQP//aa1TRUFIkTk' +
      'QrkgILM5GnF82/rfPvXhnfCfNdWzS4I6QcMMNN9xwww03gxtuQtJJOgk33IxNwg033HATkk7SSTYJN9xwww033HATEm644YYbbrgJSScZnYS' +
      'bkHSSTsLts5AKobPNhwiVDxwAAAAASUVORK5CYII='
  })
};

export function createCurve (dataSource) {
  const curve = new LogCurve(dataSource)
    .setLineStyle({
      'color': '#2196f3',
      'width': 2
    });

  const min = curve.getMinimumNormalizationLimit(),
    max = curve.getMaximumNormalizationLimit(),
    dV = (max - min) / 5;

  return curve
    .setNormalizationLimits(min - dV, max + dV);
}
