-- ============================================================
-- v3.6 Dropshipping API Integration
-- ============================================================
-- Adds config keys and webhook targets for external
-- dropshipping platforms.
-- ============================================================

-- Webhook targets for dropshipping notifications per tenant
CREATE TABLE IF NOT EXISTS dropshipping_webhooks (
    id          SERIAL PRIMARY KEY,
    event_type  VARCHAR(30) NOT NULL,  -- stock_updated, price_updated, sale_made
    target_url  TEXT NOT NULL,
    is_active   BOOLEAN DEFAULT true,
    created_at  TIMESTAMPTZ DEFAULT NOW()
);

CREATE INDEX IF NOT EXISTS idx_dropshipping_webhooks_event
    ON dropshipping_webhooks(event_type) WHERE is_active = true;
