"use strict";

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

var _MissingAdapterError = require("./MissingAdapterError.js");

class Low {
  constructor(adapter) {
    Object.defineProperty(this, "adapter", {
      enumerable: true,
      configurable: true,
      writable: true,
      value: void 0
    });
    Object.defineProperty(this, "data", {
      enumerable: true,
      configurable: true,
      writable: true,
      value: null
    });

    if (adapter) {
      this.adapter = adapter;
    } else {
      throw new _MissingAdapterError.MissingAdapterError();
    }
  }

  async read() {
    this.data = await this.adapter.read();
  }

  async write() {
    if (this.data) {
      await this.adapter.write(this.data);
    }
  }

}

exports.Low = Low;