import { Lamp } from "../components/Lamp";
import { LampLine } from "../components/LampLine";
import type { BerlinClock as BerlinClockType } from "../types";

interface BerlinClockProps {
  enabled: boolean;
  clock: BerlinClockType;
}

export function BerlinClock({ enabled, clock }: BerlinClockProps) {
  if (!enabled) return null;

  return (
    <div>
      <div data-testid="seconds-row">
        <Lamp state={clock.secondsRow[0]} id="seconds-lamp" />
      </div>
      <LampLine states={clock.fiveHours} rowTestId="five-hours-row" />
      <LampLine states={clock.oneHour} rowTestId="single-hours-row" />
      <LampLine states={clock.fiveMinutes} rowTestId="five-minutes-row" />
      <LampLine states={clock.oneMinute} rowTestId="single-minutes-row" />
    </div>
  );
}
