import { deepEqual } from '../utils/deep-equal';
export default class LayerExtension {
  static get componentName() {
    return Object.prototype.hasOwnProperty.call(this, 'extensionName') ? this.extensionName : '';
  }

  constructor(opts) {
    this.opts = void 0;

    if (opts) {
      this.opts = opts;
    }
  }

  equals(extension) {
    if (this === extension) {
      return true;
    }

    return this.constructor === extension.constructor && deepEqual(this.opts, extension.opts, 1);
  }

  getShaders(extension) {
    return null;
  }

  getSubLayerProps(extension) {
    const {
      defaultProps
    } = extension.constructor;
    const newProps = {
      updateTriggers: {}
    };

    for (const key in defaultProps) {
      if (key in this.props) {
        const propDef = defaultProps[key];
        const propValue = this.props[key];
        newProps[key] = propValue;

        if (propDef && propDef.type === 'accessor') {
          newProps.updateTriggers[key] = this.props.updateTriggers[key];

          if (typeof propValue === 'function') {
            newProps[key] = this.getSubLayerAccessor(propValue);
          }
        }
      }
    }

    return newProps;
  }

  initializeState(context, extension) {}

  updateState(params, extension) {}

  onNeedsRedraw(extension) {}

  getNeedsPickingBuffer(extension) {
    return false;
  }

  draw(params, extension) {}

  finalizeState(context, extension) {}

}
LayerExtension.defaultProps = {};
LayerExtension.extensionName = 'LayerExtension';
//# sourceMappingURL=layer-extension.js.map