import type { RequiredDeep } from 'type-fest'
import type {
  MeasurementMode,
  MeasurementModesMapping,
  MeasurementUnitsMapping,
} from '../types'
import type { MeasurementToolsComponentProps } from './types'
import { RulerIcon, BufferIcon, AreaIcon } from './icons'

export const DEFAULT_MEASUREMENT_TOOLS_LABELS: NonNullable<
  RequiredDeep<MeasurementToolsComponentProps['labels']>
> = {
  action: {
    tooltip: {
      active: 'Click on the map to start measuring',
      inactive: 'Click on the map to start measuring',
    },
  },
  chip: {
    tooltip: {
      active: 'Hide measure',
      inactive: 'Show measure',
    },
  },
  options: {
    mode: {
      title: 'Choose a measuring tool',
      options: {
        distance: 'Measure distance',
        buffer: 'Buffer distance',
        area: 'Area',
      },
    },
    units: {
      title: 'Unit of measurement',
      modal: {
        title: 'Map Measurement Unit',
        subtitle: 'Select the unit of measurement for your measurements',
        apply: 'Save',
        options: {
          metric: {
            title: 'Meters and Kilometers',
            options: {
              'm-km': 'Auto',
              kilometer: 'Kilometers',
              meter: 'Meter',
              centimeter: 'Centimeter',
              milimeter: 'Milimeter',
            },
          },
          imperial: {
            title: 'Feet and Miles',
            options: {
              'ft-mi': 'Auto',
              mile: 'Mile',
              feet: 'Feet',
              yard: 'Yard',
            },
          },
        },
      },
    },
  },
} as const

export const DEFAULT_MEASUREMENT_TOOLS_UNITS_MAPPING: MeasurementUnitsMapping =
  {
    'm-km': {
      short: 'm-km',
    },
    kilometer: {
      short: 'km',
    },
    meter: {
      short: 'm',
    },
    centimeter: {
      short: 'cm',
    },
    milimeter: {
      short: 'mm',
    },
    'ft-mi': {
      short: 'ft-mi',
    },
    mile: {
      short: 'mi',
    },
    yard: {
      short: 'yd',
    },
    feet: {
      short: 'ft',
    },
  } as const

export const DEFAULT_MEASUREMENT_TOOLS_MODES_MAPPING: MeasurementModesMapping<MeasurementMode> =
  {
    distance: {
      icon: <RulerIcon />,
    },
    buffer: {
      icon: <BufferIcon />,
    },
    area: {
      icon: <AreaIcon />,
    },
  } as const
