import { observer } from 'mobx-react';
// import { SettingsManager } from '../../../util/SettingsManager';
import { ViewBoxBaseComponent } from '../../DocComponent';
import { FieldView, FieldViewProps } from '../FieldView';
import React = require('react');
import { computed } from 'mobx';
import { MapBox } from './MapBox';

/**
 * Map Pushpin doc class
 */
@observer
export class MapPushpinBox extends ViewBoxBaseComponent<FieldViewProps>() {
    public static LayoutString(fieldKey: string) {
        return FieldView.LayoutString(MapPushpinBox, fieldKey);
    }
    componentDidMount() {
        // if (this.mapBoxView)
        this.mapBoxView.addPushpin(this.rootDoc);
    }
    componentWillUnmount() {
        this.mapBoxView.deletePushpin(this.rootDoc);
    }

    @computed get mapBoxView() {
        return this.props.DocumentView?.()?.props.docViewPath().lastElement()?.ComponentView as MapBox;
    }
    @computed get mapBox() {
        return this.props.DocumentView?.().props.docViewPath().lastElement()?.rootDoc;
    }

    render() {
        return <div></div>;
    }
}
