-- ============================================================
-- Phase 5 additions
--   - pickup_offer / dropoff_offer (two amounts from the buyer)
--   - dropoff_yard_address (manual, per-quote)
--   - delivery_method ('pickup' | 'dropoff') chosen at accept
--   - full_details_sent_at (when the accept email fired)
-- Run once via seed-phase5.php (key-guarded). Safe to re-run.
-- ============================================================

ALTER TABLE quotes ADD COLUMN IF NOT EXISTS pickup_offer         NUMERIC(10,2);
ALTER TABLE quotes ADD COLUMN IF NOT EXISTS dropoff_offer        NUMERIC(10,2);
ALTER TABLE quotes ADD COLUMN IF NOT EXISTS dropoff_yard_address VARCHAR(255);
ALTER TABLE quotes ADD COLUMN IF NOT EXISTS delivery_method      VARCHAR(20);
ALTER TABLE quotes ADD COLUMN IF NOT EXISTS full_details_sent_at TIMESTAMP;

-- Editable public-facing + SEO settings groups (JSON per key)
INSERT INTO settings (name, value) VALUES
    ('formcopy',  '{}'::jsonb),
    ('successcopy','{}'::jsonb),
    ('seo',       '{}'::jsonb)
ON CONFLICT (name) DO NOTHING;
