-- Migration 186: Customer-specific economic pricing fields
-- Adds customer-level defaults for margin, freight, supplier service flag, and invoice fee.

ALTER TABLE customers
ADD COLUMN IF NOT EXISTS standard_margin_percent NUMERIC(5,2) NOT NULL DEFAULT 20.00,
ADD COLUMN IF NOT EXISTS special_freight_price NUMERIC(10,2),
ADD COLUMN IF NOT EXISTS supplier_service_enrolled BOOLEAN NOT NULL DEFAULT FALSE,
ADD COLUMN IF NOT EXISTS invoice_fee_amount NUMERIC(10,2) NOT NULL DEFAULT 49.00;

CREATE INDEX IF NOT EXISTS idx_customers_supplier_service_enrolled
ON customers(supplier_service_enrolled);

COMMENT ON COLUMN customers.standard_margin_percent IS 'Default margin percentage used for order pricing.';
COMMENT ON COLUMN customers.special_freight_price IS 'Customer-specific freight price override.';
COMMENT ON COLUMN customers.supplier_service_enrolled IS 'Whether customer is enrolled in supplier service.';
COMMENT ON COLUMN customers.invoice_fee_amount IS 'Customer-specific invoice fee amount. 0 disables invoice fee.';
