-- Slice 8W-ResultReason · schema
-- Structured reason category on tender_tracker_results. The free-text `reason` column
-- stays as the elaborated explanation; `reason_category` classifies it for reporting.

ALTER TABLE tender_tracker_results
    ADD COLUMN reason_category ENUM(
        -- WON reasons
        'WON_BEST_PRICE','WON_BEST_TECHNICAL','WON_EXPERIENCE','WON_RELATIONSHIP','WON_SOLE_BIDDER','WON_OTHER',
        -- LOST reasons
        'LOST_PRICE_TOO_HIGH','LOST_TECHNICAL_GAP','LOST_UNFINISHED_DOCS','LOST_LATE_SUBMISSION','LOST_CLIENT_INTERNAL','LOST_OTHER',
        -- CANCELLED reasons
        'CANCELLED_CLIENT_CANCELLED','CANCELLED_SCOPE_CHANGE','CANCELLED_FUNDING_LOST','CANCELLED_OTHER',
        -- WITHDRAWN reasons
        'WITHDRAWN_TIME_PRESSURE','WITHDRAWN_DECIDED_NOT_TO_BID','WITHDRAWN_RESOURCE_UNAVAILABLE','WITHDRAWN_OTHER'
    ) NULL AFTER reason;
