import { Group, Rect } from 'react-konva';

interface ChairSilhouetteProps {
  readonly x: number;
  readonly y: number;
  readonly width: number;
  readonly depth: number;
  readonly rotation: number;
  readonly color: string;
  readonly fillColor: string;
}

/** Top-down chair silhouette: seat square + backrest line. */
export function ChairSilhouette({ x, y, width, depth, rotation, color, fillColor }: ChairSilhouetteProps) {
  const halfW = width / 2;
  const halfD = depth / 2;
  const backD = depth * 0.15;

  return (
    <Group x={x} y={y} rotation={rotation}>
      {/* Seat */}
      <Rect
        x={-halfW}
        y={-halfD + backD}
        width={width}
        height={depth - backD}
        stroke={color}
        strokeWidth={1.5}
        fill={fillColor}
        cornerRadius={width * 0.05}
        listening={false}
      />
      {/* Backrest */}
      <Rect
        x={-halfW}
        y={-halfD}
        width={width}
        height={backD}
        stroke={color}
        strokeWidth={1.5}
        fill={color}
        cornerRadius={width * 0.05}
        listening={false}
      />
    </Group>
  );
}
