-- name: GetScanSchedule :one
-- M7 recurring-scans: returns the singleton schedule row. Used by the
-- scheduler goroutine on boot and config-refresh, and by the admin GET
-- handler.
SELECT mode, interval_hours, time_of_day, weekly_day, updated_at
  FROM scan_schedule WHERE id = true;

-- name: UpdateScanSchedule :exec
-- Admin PATCH replaces the whole row; CHECK constraints enforce validity.
-- The application normalizes mode='off' to NULL the per-mode fields
-- before calling this.
UPDATE scan_schedule
   SET mode           = $1,
       interval_hours = $2,
       time_of_day    = $3,
       weekly_day     = $4,
       updated_at     = now()
 WHERE id = true;
