import { STATUS_LABEL_MAPPER } from "../../../config";

export const getRegionNameById = (id, normalizedRegions) =>
  normalizedRegions?.[id]?.name ?? id;

export const commonPopupConfig = [
  {
    name: "Адрес",
    field: "address",
  },
  {
    name: "Район",
    field: "area_id",
    fallbackField: "area",
    render: getRegionNameById,
    type: "region",
  },
  {
    name: "Округ",
    field: "district_id",
    fallbackField: "district",
    render: getRegionNameById,
    type: "region",
  },
  {
    name: "Название",
    field: "name",
  },
  {
    name: "Категория",
    field: "category",
  },
  {
    name: "Статус",
    field: "status",
    render: (value) => STATUS_LABEL_MAPPER[value],
  },
  {
    name: "Прогнозный трафик",
    field: "prediction_current",
  },
];

export const residentialPopupFields = [
  {
    name: "Кол-во квартир",
    field: "flat_cnt",
  },
  {
    name: "Год постройки",
    field: "year_bld",
  },
  {
    name: "Кол-во этажей",
    field: "levels",
  },
  {
    name: "Материал стен",
    field: "mat_nes",
  },
]

export const residentialPopupConfig = [
  ...commonPopupConfig,
  ...residentialPopupFields
];



export const workingPointFields = [
  { name: "План", field: "plan_current" },
  { name: "Факт", field: "fact" },
  { name: "Расхождение с прогнозом", field: "delta_current" },
  { name: "Зрелость", field: "age_day" },
  { name: "id локации", field: "postamat_id", empty: "Не указан" },
];

export const rivalsConfig = [
  { name: "Категория", field: "category_id" },
  { name: "Группа", field: "group_id" },
];
