import React from "react";
import Counter from "../components/Top-level/Counter/Counter";
import { useAppContext } from "../context/Index";
import styles from "./Styles.module.css";
export const SeatLimit = () => {
  const totalSeats = 60;
  const { reservedSeats } = useAppContext();
  const Seat = totalSeats - reservedSeats.length;
  const handleSeat = (seatCount) => {
    console.log("handleSeat called with seatCount:", seatCount);
    sessionStorage.setItem("seatLimit", seatCount);
    window.location.replace("/booking");
  };

  return (
    <>
      <p className={styles.line}>Remaining Seats Available:{Seat}</p>
      <Counter onSubmit={handleSeat} />
    </>
  );
};
