import type { LassoToolsState } from '../types'

type ValueProps = Partial<LassoToolsState> &
  Required<Pick<LassoToolsState, 'mapId'>>

export interface LassoToolsProviderProps {
  values: ValueProps[]
}

export interface LassoToolsStore {
  data: Record<LassoToolsState['mapId'], Omit<LassoToolsState, 'mapId'>>
  setEnabled: (
    mapId: LassoToolsState['mapId'],
    enabled: LassoToolsState['enabled'],
  ) => void
  setValue: (
    mapId: LassoToolsState['mapId'],
    id: LassoToolsState['values'][number]['id'],
    data?: Partial<LassoToolsState['values'][number]>,
  ) => void
  setVisibility: (
    mapId: LassoToolsState['mapId'],
    valueId: LassoToolsState['values'][number]['id'],
    visible: LassoToolsState['values'][number]['properties']['visible'],
  ) => void
  setModeSelected: (
    mapId: LassoToolsState['mapId'],
    mode: LassoToolsState['modeSelected'],
  ) => void
  setModeInstance: (
    mapId: LassoToolsState['mapId'],
    modeInstance: LassoToolsState['modeInstance'],
  ) => void
  setSelectedId: (
    mapId: LassoToolsState['mapId'],
    selectedId: LassoToolsState['selectedId'],
  ) => void
  setEditing: (
    mapId: LassoToolsState['mapId'],
    editing: LassoToolsState['editing'],
  ) => void
  setMaskLayerIds: (
    mapId: LassoToolsState['mapId'],
    maskLayerIds: LassoToolsState['maskLayerIds'],
  ) => void
  setMessages: (
    mapId: LassoToolsState['mapId'],
    messages: LassoToolsState['messages'],
  ) => void
  addMessage: (
    mapId: LassoToolsState['mapId'],
    message: LassoToolsState['messages'][number],
  ) => void
  removeMessage: (
    mapId: LassoToolsState['mapId'],
    id: LassoToolsState['messages'][number]['id'],
  ) => void
}
