<commit_before>import formatNumber from '../../../shared/services/number-formatter/number-formatter'
import formatDate from '../../../shared/services/date-formatter/date-formatter'
import { NORMAL_PAND_STATUSSES, NORMAL_VBO_STATUSSES } from '../map-search/status-labels'

const normalize = (result, additionalFields) => {
  return {
    ...result,
    ...additionalFields,
  }
}

export const oplaadpunten = result => {
  const CHARGER_TYPES = {
    REGULAR: 'Gewoon laadpunt',
    FAST: 'Snellaadpunt',
  }

  const additionalFields = {
    address: result.street
      ? `${result.street} ${
          result.housenumberext
            ? `${result.housenumber} ${result.housenumberext},`
            : `${result.housenumber},`
        } ${result.city}`
      : null,

    // eslint-disable-next-line no-nested-ternary
    type: result.charging_cap_max
      ? result.charging_cap_max >= 50
        ? CHARGER_TYPES.FAST
        : CHARGER_TYPES.REGULAR
      : null,

    currentStatus:
      // eslint-disable-next-line no-nested-ternary
      result.status === 'Available'
        ? result.charging_point >= 2
          ? 'Eén of meerdere beschikbaar'
          : 'Beschikbaar'
        : 'Niet beschikbaar',
    quantity: result.charging_point || false,
    geometry: result.wkb_geometry,
  }

  return normalize(result, additionalFields)
}

export const napPeilmerk = result => {
  const additionalFields = {
    wallCoordinates:
      (result.x_muurvlak || result.x_muurvlak === 0) &&
      (result.y_muurvlak || result.y_muurvlak === 0)
        ? `${result.x_muurvlak}, ${result.y_muurvlak}`
        : '',
    height:
      result.hoogte_nap || result.hoogte_nap === 0 ? `${formatNumber(result.hoogte_nap)} m` : '',
  }

  return normalize(result, additionalFields)
}

export const adressenPand = result => {
  const additionalFields = {
    statusLevel:
      // eslint-disable-next-line no-nested-ternary
      result.status && result.status.omschrijving
        ? NORMAL_PAND_STATUSSES.includes(result.status.omschrijving)
          ? ''
          : 'info'
        : false,
    isNevenadres: !result.hoofdadres,
    year: result.oorspronkelijk_bouwjaar !== 1005 ? result.oorspronkelijk_bouwjaar : 'Onbekend', // The API returns 1005 when a year is unknown
  }

  return normalize(result, additionalFields)
}

export const adressenVerblijfsobject = result => {
  const additionalFields = {
    statusLevel:
      // eslint-disable-next-line no-nested-ternary
      result.status && result.status.omschrijving
        ? NORMAL_VBO_STATUSSES.includes(result.status.omschrijving)
          ? ''
          : 'alert'
        : false,
    isNevenadres: !result.hoofdadres,
    gebruiksdoelen: ((result.gebruiksdoelen && result.gebruiksdoelen.slice(0, 5)) || [])
      .map(
        item =>
          `${item.omschrijving}${item.omschrijving_plus ? `: ${item.omschrijving_plus}` : ''}`,
      )
      .join('\n'),
    size: result.oppervlakte > 1 ? `${result.oppervlakte.toLocaleString('nl-NL')} m²` : 'onbekend',
  }

  return normalize(result, additionalFields)
}

export const kadastraalObject = result => {
  const additionalFields = {
    size:
      result.grootte || result.grootte === 0 ? `${result.grootte.toLocaleString('nl-NL')} m²` : '',<commit_msg>Fixed bug due to merging<commit_after>import formatNumber from '../../../shared/services/number-formatter/number-formatter'
import formatDate from '../../../shared/services/date-formatter/date-formatter'
import { NORMAL_PAND_STATUSSES, NORMAL_VBO_STATUSSES } from '../map-search/status-labels'

const normalize = (result, additionalFields) => {
  return {
    ...result,
    ...additionalFields,
  }
}

export const oplaadpunten = result => {
  const CHARGER_TYPES = {
    REGULAR: 'Gewoon laadpunt',
    FAST: 'Snellaadpunt',
  }

  const additionalFields = {
    address: result.street
      ? `${result.street} ${
          result.housenumberext
            ? `${result.housenumber} ${result.housenumberext},`
            : `${result.housenumber},`
        } ${result.city}`
      : null,

    // eslint-disable-next-line no-nested-ternary
    type: result.charging_cap_max
      ? result.charging_cap_max >= 50
        ? CHARGER_TYPES.FAST
        : CHARGER_TYPES.REGULAR
      : null,

    currentStatus:
      // eslint-disable-next-line no-nested-ternary
      result.status === 'Available'
        ? result.charging_point >= 2
          ? 'Eén of meerdere beschikbaar'
          : 'Beschikbaar'
        : 'Niet beschikbaar',
    quantity: result.charging_point || false,
    geometry: result.wkb_geometry,
  }

  return normalize(result, additionalFields)
}

export const napPeilmerk = result => {
  const additionalFields = {
    wallCoordinates:
      (result.x_muurvlak || result.x_muurvlak === 0) &&
      (result.y_muurvlak || result.y_muurvlak === 0)
        ? `${result.x_muurvlak}, ${result.y_muurvlak}`
        : '',
    height:
      result.hoogte_nap || result.hoogte_nap === 0 ? `${formatNumber(result.hoogte_nap)} m` : '',
  }

  return normalize(result, additionalFields)
}

export const adressenPand = result => {
  const additionalFields = {
    statusLevel:
      // eslint-disable-next-line no-nested-ternary
      result.status && result.status.omschrijving
        ? NORMAL_PAND_STATUSSES.includes(result.status.omschrijving)
          ? ''
          : 'info'
        : false,
    isNevenadres: !result.hoofdadres,
    year: result.oorspronkelijk_bouwjaar !== '1005' ? result.oorspronkelijk_bouwjaar : 'Onbekend', // The API returns 1005 when a year is unknown
  }

  return normalize(result, additionalFields)
}

export const adressenVerblijfsobject = result => {
  const additionalFields = {
    statusLevel:
      // eslint-disable-next-line no-nested-ternary
      result.status && result.status.omschrijving
        ? NORMAL_VBO_STATUSSES.includes(result.status.omschrijving)
          ? ''
          : 'alert'
        : false,
    isNevenadres: !result.hoofdadres,
    gebruiksdoelen: ((result.gebruiksdoelen && result.gebruiksdoelen.slice(0, 5)) || [])
      .map(
        item =>
          `${item.omschrijving}${item.omschrijving_plus ? `: ${item.omschrijving_plus}` : ''}`,
      )
      .join('\n'),
    size: result.oppervlakte > 1 ? `${result.oppervlakte.toLocaleString('nl-NL')} m²` : 'onbekend',
  }

  return normalize(result, additionalFields)
}

export const kadastraalObject = result => {
  const additionalFields = {
    size:
      result.grootte || result.grootte === 0 ? `${result.grootte.toLocaleString('nl-NL')} m²` : '',
{'fraction_non_alphanumeric': 0.13741392501912778, 'fraction_numerical': 0.0055087987758224944, 'mean_word_length': 2.860602480803308, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6599675', 'n_tokens_mistral': 2257, 'n_tokens_neox': 2223, 'n_words': 356}