-- Slice 8N-PricingMode · schema
-- Adds pricing mode to tender_pricing_versions.
-- PER_ITEM = client sees per-line bid (BOQ-style). sum_price = SUM(lines) + prelims. (Today's behaviour.)
-- LUMPSUM  = client sees ONE bid total. sum_price = lumpsum_amount. Internal sections/lines still track cost
--           for margin visibility; buyer never sees the breakdown.

ALTER TABLE tender_pricing_versions
    ADD COLUMN pricing_mode ENUM('PER_ITEM','LUMPSUM') NOT NULL DEFAULT 'PER_ITEM' AFTER default_markup_pct,
    ADD COLUMN lumpsum_amount DECIMAL(20,2) NOT NULL DEFAULT 0.00 AFTER pricing_mode,
    ADD COLUMN lumpsum_notes  VARCHAR(500)  NULL             AFTER lumpsum_amount;

-- All existing rows are implicitly PER_ITEM (default). No backfill needed.
