import { useMemo } from "react";

const REGION_FIELD_MAPPER = {
  ao: "district_id",
  rayon: "area_id",
};

export const useRegionFilterExpression = (region) => {
  return useMemo(
    () =>
      region
        ? ["==", ["get", REGION_FIELD_MAPPER[region.type]], region.id]
        : null,
    [region]
  );
};
