const mergeOptions = require('merge-options'); const BaseState = require('./BaseState'); class ColorlampState extends BaseState { constructor(cloneObj) { let cloneState = mergeOptions(ColorlampState.default, cloneObj); this.on = cloneState.on; this.brightness = cloneState.brightness; this.color = { hue: cloneState.color.hue, sat: cloneState.color.sat, l: cloneState.color.l }; } static get default() { return { on: false, brightness: 0, color: { hue: 0, sat: 0, l: 0 } }; } get asObj() { return { on: this.on, brightness: this.brightness, color: { hue: this.color.hue, sat: this.color.sat, l: this.color.l } }; } } module.exports = ColorlampState;