# Requirement change

Our field engineers have been complaining and they are right. At the moment there is no way to take
a machine out of service. They open it up to restock or fix a jam, and customers keep pushing coins
in while the rack is half empty and the tray is open. Last month one of them got charged for a
chocolate that was in the engineer's hand.

So the machine needs to be able to go **out of service** and come back.

- The engineer switches it out of service, and from that moment it does nothing for a customer.
  No coins. No selections. No handing anything over. Not even the coin return — there is nothing
  in there to return, because of the next point.
- **It can only be switched out of service when it is idle.** If a customer has money in, or an
  item sitting in the tray waiting to be picked up, the machine refuses to go out of service until
  that customer is finished. I am not having someone's dollar locked inside a machine with an
  engineer's arm in it.
- The engineer switches it back into service and it is idle again, ready for the next customer,
  with exactly the stock and the coins it had when it went out. Going out of service and coming
  back changes nothing about what is in it.
- Switching it out of service when it is already out, or back in when it was never out, is a
  mistake and should be refused like any other operation the machine will not do.
- Actual restocking and refilling the coin hopper are somebody else's problem — not in this change.

> Your contract folder has an updated `MachineState` and an updated `VendingMachineApi`; drop them
> over the ones you were given. The two new calls are
>
>     void enterMaintenance()
>     void leaveMaintenance()
>
> Declaring them is expected to cost you a few lines, and the budget accounts for it.
