import { useCallback } from 'react';
import getColor from "../../../utils/colors/getColor.js";
import getElectionPaletteColor from "../../../utils/colors/getElectionPaletteColor.js";
const useGetDistrictProps = function useGetDistrictProps(colors) {
  return useCallback(({
    code
  }) => {
    const color = colors.fipsToPalette.get(code);
    if (!color || color.statusIsUnclear) {
      return {
        fill: 'white',
        stroke: getColor('warmgray-100')
      };
    }
    if (color.status.outcome === 'winner') {
      return {
        fill: getColor(getElectionPaletteColor(color.palette, 'main')),
        stroke: 'white'
      };
    }
    if (color.status.outcome === 'runoff') {
      return {
        fill: getColor('runoff'),
        stroke: getColor('yellow-90')
      };
    }
    return {
      fill: `url(#${color.palette}-leading)`,
      stroke: 'white'
    };
  }, [colors]);
};
export default useGetDistrictProps;