import { TRANSITION_STYLE } from "../constants";
import type { OrganSvgProps } from "../types";

export function Kidney({ style, colorScale, isActive = false, className }: OrganSvgProps) {
  const defaultColor = colorScale[200];
  const activeColor = colorScale[300];
  const fill = style?.fill ?? (isActive ? activeColor : defaultColor);

  return (
    <g className={className} data-organ="kidney">
      <path
        d={LEFT_KIDNEY_PATH}
        fill={fill}
        stroke={style?.stroke}
        strokeWidth={style?.strokeWidth}
        style={{ transition: TRANSITION_STYLE }}
      />
      <path
        d={RIGHT_KIDNEY_PATH}
        fill={fill}
        stroke={style?.stroke}
        strokeWidth={style?.strokeWidth}
        style={{ transition: TRANSITION_STYLE }}
      />
      <path
        d={BLADDER_PATH}
        fill={fill}
        stroke={style?.stroke}
        strokeWidth={style?.strokeWidth}
        style={{ transition: TRANSITION_STYLE }}
      />
    </g>
  );
}

const LEFT_KIDNEY_PATH =
  "M8.58428 12.0942C8.71329 11.3139 8.94842 8.45282 6.37448 6.69039C6.35992 6.69872 6.57424 6.56555 6.68868 6.49064C7.15894 6.18268 7.48562 5.78109 7.63544 5.31083C7.74364 4.97374 7.76029 4.60336 7.67498 4.20593C7.50227 3.40275 6.95294 2.68488 6.2642 2.26872C4.61622 1.2741 2.17962 2.0981 1.27655 3.71487C0.494178 5.109 0.0613737 6.69247 0.00727326 8.28844C-0.0426656 9.7762 0.148767 11.6343 1.0768 12.8578C1.75513 13.7505 2.67692 14.4497 4.08978 14.4392C5.86469 14.4288 7.0549 13.3198 7.44609 12.0984C7.5418 11.7987 7.68122 11.1828 7.67914 11.1953C7.3254 14.872 4.39565 21.8843 4.37068 24.3729C4.34572 26.9739 3.92956 29.912 6.81561 33.3453C6.96126 33.0332 7.27546 32.6961 7.41488 32.565C3.98158 29.0526 5.28207 24.0587 5.67118 21.6409C6.06237 19.223 8.45527 12.8766 8.58428 12.0963V12.0942Z";
const RIGHT_KIDNEY_PATH =
  "M24.9914 6.4704C24.9477 5.11373 24.7396 3.97138 24.184 2.73123C23.7096 1.67211 22.8399 0.723268 21.7433 0.296706C20.6925 -0.111128 19.419 -0.148582 18.4556 0.502704C17.5443 1.11862 16.7203 2.60222 17.2862 3.67799C17.4465 3.98178 17.7066 4.23148 18.0166 4.42915C18.2247 4.56232 18.6471 4.77872 18.6221 4.76624C16.1085 6.61398 16.4373 9.46466 16.5933 10.2408C16.7494 11.0169 19.3545 17.278 19.8248 19.6834C20.2951 22.0888 20.5073 29.0199 17.1926 32.6425C17.2717 32.7029 17.4798 32.9193 17.6878 33.2918C20.4574 29.7627 21.273 25.2017 20.8361 20.728C20.4823 17.122 18.1539 13.1539 17.5505 9.83296C17.6899 10.2574 17.9001 10.6528 18.131 10.9483C18.8468 11.8617 19.9892 12.3694 21.1232 12.4319C22.4154 12.5026 23.7471 11.4248 24.3422 10.3407C24.9477 9.23993 25.0309 7.70015 24.9914 6.4704Z";
const BLADDER_PATH =
  "M6.55252 33.7413C6.13636 34.8857 6.11139 36.2903 8.42522 37.6157C9.90675 38.4231 11.4174 38.5001 11.4673 40.0877L11.8232 48.2028C11.8232 48.2818 12.1103 48.3068 12.2393 48.3068C12.3683 48.3068 12.6305 48.2818 12.6305 48.2028L13.134 40.0877C13.2381 38.448 13.8894 38.7872 16.2032 37.6157C18.517 36.4442 18.413 34.6777 17.8928 33.7413C17.3726 32.8049 16.3572 30.8802 12.4037 30.8802C8.45019 30.8802 6.96867 32.5969 6.55252 33.7413Z";
