-- Sprint 3 — the vendor signup wizard starts writing to the database.
--
-- Until now the 5-step wizard validated its input, set a flag and rendered
-- "Application received". Nothing was persisted: a vendor completed signup, was
-- told they had applied, and did not exist. Making it real needs somewhere to
-- put two fields the wizard has always collected AND shown back on its own
-- review page, which no column covered:
--
--   operating_hours — free text as the vendor types it ("08:00 - 20:00"). NOT
--                     the global app_settings operating hours, which are DAN's
--                     dispatch window and apply to everyone.
--   monthly_volume  — the expected-volume bracket ("10-50"), intake context for
--                     whoever reviews the application.
--
-- Both nullable: every existing vendor predates the wizard and has neither.
-- (`paybillOk`, the wizard's third orphan field, gets no column — it was dead
-- state that nothing rendered, and is deleted from the form instead.)
--
-- `status` also grows a 'rejected' value. Applications land as 'pending' per the
-- README ("applications go in pending state until admin approval"), and an admin
-- must be able to refuse one — previously the enum could only pause or suspend a
-- vendor who had already been accepted, which is a different thing entirely. The
-- reason for a refusal lives in the vendor_events audit row (013), not in a
-- column here, so it sits alongside who did it and when.
ALTER TABLE vendors
  ADD COLUMN operating_hours VARCHAR(32) NULL AFTER pickup_landmark,
  ADD COLUMN monthly_volume  VARCHAR(16) NULL AFTER operating_hours,
  MODIFY COLUMN status ENUM('active','pending','paused','suspended','rejected')
    NOT NULL DEFAULT 'pending';

-- vendor_events (013) was created knowing only about edits to an existing
-- vendor. It now also has to record the three moments in an application's life:
-- it arriving, and an admin accepting or refusing it. A refusal's reason goes in
-- this row's `note`, alongside who refused it and when.
ALTER TABLE vendor_events
  MODIFY COLUMN type ENUM(
    'profile_update','paybill_update','application','approved','rejected'
  ) NOT NULL;
