//TODO: mock imagebox, create marker as a doc
import { IReactionDisposer } from "mobx";
import { observer } from "mobx-react";
import * as React from "react";
import { documentSchema } from "../../../../fields/documentSchemas";
import { createSchema, makeInterface } from "../../../../fields/Schema";
import { ViewBoxBaseComponent } from "../../DocComponent";
import { FieldView, FieldViewProps } from "../FieldView";

export const markerSchema = createSchema({
    lat: "number",
    lng: "number"
});

type MarkerDocument = makeInterface<[typeof markerSchema, typeof documentSchema]>;
const MarkerDocument = makeInterface(markerSchema, documentSchema);

@observer
export class MapMarker extends ViewBoxBaseComponent<FieldViewProps, MarkerDocument>(MarkerDocument) {
    public static LayoutString(fieldKey: string) { return FieldView.LayoutString(MapMarker, fieldKey); }
    private _markerRef: React.RefObject<google.maps.Marker> = React.createRef();
    private _disposers: { [name: string]: IReactionDisposer } = {};
}