import { Class, ValueOf } from 'type-fest';
import { ReactNode, RefObject } from 'react';
import { Layer, LayerProps, MapViewState, PickingInfo, ViewStateChangeParameters } from '@deck.gl/core';
import { DeckGLProps, DeckGLRef } from '@deck.gl/react';
import { MapRef, AttributionControlProps as ReactMapGLAttributionControlProps } from 'react-map-gl/maplibre';
import { CartoBasemaps, GmapsBasemap, MapsTypes } from './const';
import { MapProps, APIProviderProps } from '@vis.gl/react-google-maps';
import { ViewStateSlice } from './providers/map/types';
import { GoogleMapsOverlay } from '@deck.gl/google-maps';
export * from './common-types';
export type AttributionControlProps = ReactMapGLAttributionControlProps;
export type BasemapKey = keyof typeof CartoBasemaps | keyof typeof GmapsBasemap;
export type BasemapType = ValueOf<typeof MapsTypes>;
export interface Tooltip<T = unknown> extends PickingInfo<T> {
    text?: string | undefined;
    html?: string | undefined;
    className?: string | undefined;
    style?: Partial<CSSStyleDeclaration> | undefined;
}
export interface LayerType<T extends Class<Layer> = Class<Layer>, P extends LayerProps = LayerProps> {
    type: T | null;
    props: Partial<P>;
}
export type InstanceRef = DeckGLRef;
export type OverlayRef = MapRef | google.maps.Map | null | undefined;
export type GmapsProps = Omit<MapProps, 'mapTypeId'> & {
    apiKey: string;
    APIProviderProps?: Omit<APIProviderProps, 'apiKey'>;
};
export interface DeckGLComponentProps extends Omit<DeckGLProps, 'layers' | 'onLoad'> {
    basemap?: BasemapKey;
    instanceRef?: RefObject<InstanceRef | GoogleMapsOverlay>;
    overlayRef?: RefObject<OverlayRef>;
    layers: LayerType[];
    gmapsProps?: GmapsProps;
    onLoad?: (value: boolean) => void;
    attributionProps?: AttributionControlProps;
    onIdle?: () => void;
}
export type ViewStateChange = ViewStateChangeParameters<MapViewState>;
export type ViewStateChangeCallback = (id: MapComponentProps['id'], props: MapViewState) => void;
export interface MapComponentProps extends Omit<DeckGLComponentProps, 'onViewStateChange' | 'layers' | 'controller'> {
    id: NonNullable<DeckGLComponentProps['id']>;
    onViewStateChange?: (props: ViewStateChangeParameters<MapViewState>, callback: ViewStateChangeCallback) => void;
    onIdle?: () => void;
}
export interface LayersLoadedProps {
    id: MapComponentProps['id'];
}
export interface ZoomControl {
    mapId: MapComponentProps['id'];
    children: (props: ZoomControlChildrenProps) => ReactNode;
}
export interface ZoomControlChildrenProps {
    zoom: MapViewState['zoom'];
    maxZoom: MapViewState['maxZoom'];
    minZoom: MapViewState['minZoom'];
    isLoading: boolean;
    setZoom: (zoom: Parameters<ViewStateSlice['setZoom']>[1]) => void;
    flyTo: (viewState: MapViewState) => void;
    resetViewState: () => void;
}
export interface BasemapsControlsProps {
    mapId: MapComponentProps['id'];
    children: (props: BasemapsControlsChildrenProps) => ReactNode;
}
export interface BasemapsControlsChildrenProps {
    basemap: MapComponentProps['basemap'];
    setBasemap: (basemap: NonNullable<MapComponentProps['basemap']>) => void;
}
