from seating import Receipt, Seat_Row, cancel, check_request, count_free, reserve


def main() -> None:
    taken = Seat_Row([True, True, False, True, False, True, False, True])
    full = Seat_Row([True, True, True, True, True, True, True, True])
    first: Receipt = check_request(taken, 1)
    slip: Receipt = check_request(taken, 3)
    assert first.requested == 1 and not first.available
    assert slip.requested == 3 and slip.available
    print("Seat 1 is taken.")
    print("Seat 3 is available.")
    print("Free seats:", count_free(taken))

    accepted: bool = reserve(taken, 3)
    assert accepted and taken[2] and taken[3] and not taken[4]
    print("Seat 3 reserved.")
    print("Free seats:", count_free(taken))

    accepted = reserve(taken, 3)
    assert not accepted and taken[2] and taken[3] and not taken[4]
    print("Seat 3 already taken.")
    print("Free seats:", count_free(taken))

    released: bool = cancel(taken, 3)
    assert released and not taken[2] and taken[3] and not taken[4]
    print("Seat 3 released.")
    print("Free seats:", count_free(taken))

    accepted = reserve(full, 8)
    assert not accepted
    assert all(full[slot] for slot in range(8))
    print("Full house: seat 8 refused.")


if __name__ == "__main__":
    main()
