import {
  JIBESTREAM_DESTINATION,
  INSTRUCTION,
  JIBESTREAM_WAYPOINT,
  JIBESTREAM_PATH,
  JIBESTREAM_STYLE,
  MAP_CREDENTIALS,
  MAP_COMPASS_PROPERTIES,
  MAP_FLOOR_SELECTOR_PROPERTIES,
  MAP_SEARCH_PROPERTIES,
  MAP_ZOOM_BUTTON_PROPERTIES,
} from './JibestreamTypes';
import { ODP_ON_FACILITY_UPDATE } from './schemas/OdpOnFacilityUpdateType';
import { ODP_ON_KEY_VALIDATION } from './schemas/OdpOnKeyValidationType';
import { ODP_ON_NAVIGATION_UPDATE } from './schemas/OdpOnNavigationUpdateType';
import { ODP_ON_READY } from './schemas/OdpOnReadyType';

export type COMMANDS_TO_MAP =
  | 'UPDATE_USER_LOCATION'
  | 'WAYFIND_TO_WAYPOINT'
  | 'WAYFIND_BETWEEN_WAYPOINTS'
  | 'DRAW_NAVIGATION_PATH'
  | 'CLEAR_WAYFINDING_PATH'
  | 'SET_FOLLOW_BLUE_DOT'
  | 'CENTER_MAP_ON_POINT'
  | 'STYLE_SHAPE'
  | 'RESET_ALL_UNIT_STYLES'
  | 'SET_MAP_VENUE';
export type COMMANDS_FROM_MAP =
  | 'DESTINATION_SELECTED'
  | 'NAVIGATION_PATH_GENERATED'
  | 'USER_POSITION_UPDATED'
  | 'WINDOW_LOADED'
  | 'MAP_TAPPED_GENERIC'
  | 'GENERATED_SEARCH_DESTINATIONS'
  | 'TESTING'
  | 'CONSOLE_LOG';
export type EVENTS_FROM_ODP = 'ON_NAVIGATION_UPDATE' | 'ON_FACILITY_UPDATE';

export type MAP_EVENT_LISTENER = {
  onDestinationSelected?: (destination: JIBESTREAM_DESTINATION) => void;
  onNavigationPathGenerated?: (
    pathId: string,
    instructions: INSTRUCTION[],
    start: JIBESTREAM_WAYPOINT,
    end: JIBESTREAM_WAYPOINT,
    path: JIBESTREAM_PATH[]
  ) => void;
  onUserPositionUpdated?: (userPosition: number[]) => void;
  onSearchDestinationsGenerated?: (
    destinations: JIBESTREAM_DESTINATION_SET[]
  ) => void;
  onWindowLoaded?: () => void;
  onMapTappedGeneric?: (event: MAP_TAP_EVENT) => void;
};

export type ODP_EVENT_LISTENER = {
  onReady?: (message: ODP_ON_READY) => void;
  onKeyValidation?: (message: ODP_ON_KEY_VALIDATION) => void;
  onNavigationUpdate?: (message: ODP_ON_NAVIGATION_UPDATE) => void;
  onFacilityUpdate?: (message: ODP_ON_FACILITY_UPDATE) => void;
};

export type MAP_VIEW_REFERENCE = {
  setMapVenue: (credentials: MAP_CREDENTIALS) => void;
//   setMapVenue: ({
//     credentials,
//     compass,
//     floorSelector,
//     zoomButtons,
//     search,
//   }: {
//     credentials: MAP_CREDENTIALS;
//     compass?: MAP_COMPASS_PROPERTIES;
//     floorSelector?: MAP_FLOOR_SELECTOR_PROPERTIES;
//     zoomButtons?: MAP_ZOOM_BUTTON_PROPERTIES;
//     search?: MAP_SEARCH_PROPERTIES;
//   }) => void;
  centerMapOnUser: (orientation: number, animationDuration?: number) => void;
//   centerMapOnPoint: (point: number[]) => void;
//   setFollowBlueDot: (
//     enabled: boolean,
//     rotate?: boolean,
//     interval?: number
//   ) => void;
  setUserPosition: (lat: number, long: number, heading: number) => void;
//   setUserPositionXY: (x: number, y: number, heading: number) => void;
//   clearWayfindingPath: () => void;
//   wayfindToWaypoint: (waypointId: number) => void;
//   wayfindBetweenWaypoints: (originId: number, destinationId: number) => void;
//   drawNavigationPath: (
//     pathId: string,
//     shouldFocus?: boolean,
//     style?: JIBESTREAM_STYLE
//   ) => void;
//   styleUnitsForDestination: (
//     destination: JIBESTREAM_DESTINATION,
//     style?: JIBESTREAM_STYLE
//   ) => void;
//   styleShape: (id: number, style?: JIBESTREAM_STYLE) => void;
};

export type ODP_VIEW_REFERENCE = {
  startOdp: (key: string, host: string) => void;
  uploadLogs: () => void;
};
