import { useMemo } from "react";

const REGION_FIELD_MAPPER = {
  ao: "ao_id",
  rayon: "rayon_id",
};

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