import React, { ForwardedRef, useContext } from 'react';
import { OriginIconProps } from '../type';
import { Context } from '../context';

function IconSchemaComponent(props: OriginIconProps, ref: ForwardedRef<SVGSVGElement>) {
    const { prefix: prefixFromContext } = useContext(Context);
    const { className = '', prefix: prefixFromProps, width = '1em', height = '1em', useCurrentColor = true, spin, ...rest } = props;

    const prefix = prefixFromProps || prefixFromContext || 'hiagent';
    const loadingKls = spin ? ` ${prefix}-icon-loading` : '';
    return <svg className={`${prefix}-icon ${prefix}-icon-schema${loadingKls} ${className}`} width={width} height={height} xmlns="http://www.w3.org/2000/svg" fill={useCurrentColor ? 'currentColor' : '#000'} viewBox="0 0 16 16" {...rest} ref={ref}><path d="M10.24 1.35c.17 0 .387.06.506.179l3.234 3.233a.562.562 0 0 1 .16.356l.009.002v7.256a2.283 2.283 0 0 1-2.283 2.283H4.122a2.282 2.282 0 0 1-2.282-2.283V3.633A2.282 2.282 0 0 1 4.122 1.35h6.118ZM4.122 2.595c-.573 0-1.037.464-1.037 1.037v8.745c0 .572.464 1.037 1.037 1.037h7.744c.573 0 1.037-.465 1.037-1.037V5.86a1 1 0 0 0-.293-.707l-2.264-2.265a1 1 0 0 0-.707-.293H4.122Zm2.125 4.366a.55.55 0 0 1 .779.778L5.747 9.016l1.279 1.278a.55.55 0 0 1-.779.779L4.581 9.406a.55.55 0 0 1 0-.779l1.666-1.666Zm2.404 0a.55.55 0 0 1 .778 0l1.667 1.666a.55.55 0 0 1 0 .779l-1.667 1.667a.55.55 0 0 1-.778-.779l1.277-1.278L8.65 7.74a.55.55 0 0 1 0-.778Z"/></svg>;
}

const IconSchema = React.forwardRef(IconSchemaComponent);
export default IconSchema;
