"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.heightFieldDefs = exports.weightFieldDefs = void 0;

var _parseWeight = require("../utils/parse-weight");

var _parseHeight = require("../utils/parse-height");

const prompt = 'Interpreted value will appear here';

const getMessage = val => val ? "interpreted as: ".concat(val) : "Couldn't parse, please try again";

const weightFieldDefs = [{
  label: 'Weight',
  name: 'weight_raw',
  subLabel: item => item.value ? getMessage((0, _parseWeight.parseThenRestateWeight)(item.value)) : prompt,
  completenessTest: _parseWeight.parseThenRestateWeight,
  test: val => val && ((0, _parseWeight.parseThenRestateWeight)(val) ? null : 'Failed to parse'),
  onInput: true,
  tourVal: '125 lbs',
  inputWidth: '120px',
  getUpdates: val => ({
    weight_raw: val || '',
    weight: (0, _parseWeight.parseWeightInKg)(val)
  })
}, {
  name: 'weight',
  hidden: true
}];
exports.weightFieldDefs = weightFieldDefs;
const heightFieldDefs = [{
  label: 'Height',
  name: 'height_raw',
  subLabel: item => item.value ? getMessage((0, _parseHeight.parseThenRestateHeight)(item.value)) : prompt,
  completenessTest: _parseHeight.parseThenRestateHeight,
  test: val => val && ((0, _parseHeight.parseThenRestateHeight)(val) ? null : 'Failed to parse'),
  onInput: true,
  tourVal: '5\'7"',
  inputWidth: '120px',
  getUpdates: val => ({
    height_raw: val || '',
    height: (0, _parseHeight.parseHeightInCm)(val)
  })
}, {
  name: 'height',
  hidden: true
}];
exports.heightFieldDefs = heightFieldDefs;