import React from 'react';
import Svg from 'react-native-svg';
import type { IllustrationSvgProps } from './types';
import { DEFAULT_ILLUSTRATION_SIZE } from './constants';

interface BaseSvgProps extends IllustrationSvgProps {
  children: React.ReactNode;
  viewBox?: string;
}

const BaseSvg = ({
  children,
  width = DEFAULT_ILLUSTRATION_SIZE,
  height = DEFAULT_ILLUSTRATION_SIZE,
  viewBox,
  testID,
}: BaseSvgProps) => {
  const defaultViewBox =
    viewBox || `0 0 ${DEFAULT_ILLUSTRATION_SIZE} ${DEFAULT_ILLUSTRATION_SIZE}`;

  return (
    <Svg width={width} height={height} viewBox={defaultViewBox} testID={testID}>
      {children}
    </Svg>
  );
};

export default BaseSvg;
