"use strict";

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

var _preact = require("preact");

var _section = _interopRequireDefault(require("./section"));

var _componentCode = _interopRequireDefault(require("./component-code"));

var _editableDescription = require("../macros/editable-description");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const caseMacro = {
  healthyPatient: true,
  copied: {
    sedationLevel: 'Moderate',
    ivEnabled: true,
    airwayEnabled: true,
    recorderName: 'Joe Smith',
    present: 'Clair Kohler, Justin Mayert',
    userRole: 'both',
    asaClassification: '1',
    mallampati: 'Class II',
    weightDistribution: 'Waist and above',
    reasonForSedation: 'Inability to achieve profound local anesthesia',
    pregnant: 'n',
    breastfeeding: false,
    breastfeedingInstructionsGiven: false,
    lastFood: '9pm',
    lastDrink: '9pm',
    procedureNotes: 'This is where procedural notes are entered.',
    recoveryNotes: 'This is where recovery notes are entered.',
    preProcedureRiskAssessment: 'Facial hair could make masking more difficult.',
    dischargeScoreType: 'aldrete'
  },
  vitalTypes: {
    fio2: 'selected',
    eto2: 'selected',
    fin2o: 'selected',
    etn2o: 'selected',
    fisev: 'selected'
  },
  parenDrugs: [{
    id: '4337',
    name: 'Fentanyl',
    unit: 'mcg',
    draw: '100'
  }, {
    id: '6960',
    name: 'Midazolam',
    route: 'IV',
    unit: 'mg',
    draw: '10',
    dose: '10'
  }],
  airways: [{
    type: 'nt',
    size: '18fr',
    notes: 'Some other placement notes',
    removalNotes: 'removal was easy for nt',
    placementCompDetail: 'placement was complicated for nt'
  }, {
    type: 'opa',
    size: '50mm',
    notes: 'Some other placement notes',
    removalNotes: 'removal was easy for opa',
    placementCompDetail: 'placement was complicated for opa'
  }, {
    type: 'cpap',
    maskType: 'Nasal',
    peep: '2.2',
    notes: 'Some other placement notes',
    removalNotes: 'removal was easy for cpap',
    placementCompDetail: 'placement was complicated for cpap'
  }, {
    type: 'et',
    size: '6.5',
    stylet: false,
    cuffed: true,
    scope: 'Macintosh',
    scopeType: 'Video',
    bladeSize: '3',
    viewGrade: 'Grade IV',
    securedWith: 'tape',
    depth: '18',
    eyeProtection: 'Confirmed no contacts',
    confirmation: 'Return to baseline of SpO₂',
    notes: 'Some other placement notes',
    preOx: '4x tidal volume breaths',
    magill: 'Used Magill forceps to aid intubation',
    cavityClear: true,
    preRemovalSpo2: '95',
    postRemovalSpo2: '100',
    removalComp: true,
    removalNotes: 'removal was easy for et',
    placementCompDetail: 'placement was complicated for et',
    inflated: true,
    deflated: true,
    removalCompDetail: 'removal was complicated for et'
  }, {
    type: 'ntt',
    size: '4.5',
    vaso: 'Oxymetazoline',
    lube: true,
    preWarmed: true,
    side: 'R',
    cuffed: true,
    scope: 'Miller',
    scopeType: 'Direct',
    bladeSize: '2',
    viewGrade: 'Grade I',
    securedWith: 'tape',
    depth: '18',
    eyeProtection: 'Confirmed no contacts',
    confirmation: 'Return to baseline of SpO₂',
    notes: 'Some other placement notes',
    preOx: '4x tidal volume breaths',
    magill: 'Used Magill forceps to aid intubation',
    cavityClear: true,
    preRemovalSpo2: '95',
    postRemovalSpo2: '100',
    removalComp: true,
    removalNotes: 'removal was easy for ntt',
    placementCompDetail: 'placement was complicated for ntt',
    inflated: true,
    deflated: true,
    removalCompDetail: 'removal was complicated for ntt'
  }, {
    type: 'lma',
    size: '20.3',
    lube: true,
    securedWith: 'tape',
    confirmation: 'Return to baseline of SpO₂',
    notes: 'Some other placement notes',
    preOx: '4x tidal volume breaths',
    cavityClear: true,
    preRemovalSpo2: '95',
    postRemovalSpo2: '100',
    removalComp: true,
    removalNotes: 'removal was easy for lma',
    placementCompDetail: 'placement was complicated for lma',
    removalCompDetail: 'removal was complicated for lma'
  }, {
    type: 'other',
    name: 'King Airway',
    notes: 'placement went fine for other',
    removalNotes: 'removal was easy for other'
  }],
  pos: ['Supine', 'Supine'],
  iv: {
    location: 'AC',
    side: 'Right',
    securedWith: 'Tape',
    attempts: 1,
    needleGauge: '22',
    solutionType: 'D5W'
  }
};

class MacroSection extends _preact.Component {
  constructor(props) {
    super(props);
    this.updateMacro = this.updateMacro.bind(this);
    this.state = {
      macro: caseMacro
    };
  }

  updateMacro(macro) {
    this.setState({
      macro
    });
  }

  render() {
    return (0, _preact.h)("div", null, (0, _preact.h)(_section.default, {
      title: "Macros"
    }, (0, _preact.h)(_componentCode.default, {
      name: "Macro",
      code: "<EditableMacroDescription\n  macro={caseMacro}\n  onChange={update => {\n    console.log('changed state', update)\n  }}\n/>"
    }), (0, _preact.h)(_editableDescription.EditableMacroDescription, {
      macro: caseMacro,
      onChange: update => {
        // eslint-disable-next-line no-console
        console.log('changed state', update);
      }
    })));
  }

}

exports.MacroSection = MacroSection;