-- Migration 012: Add default product category to templates
-- Allows templates to specify default category for line items (varesalg, drift, etc.)

ALTER TABLE supplier_invoice_templates
ADD COLUMN IF NOT EXISTS default_product_category VARCHAR(50) DEFAULT 'varesalg',
ADD COLUMN IF NOT EXISTS default_product_group_number INTEGER;

-- Valid categories: varesalg, drift, anlæg, abonnement, lager, udlejning
COMMENT ON COLUMN supplier_invoice_templates.default_product_category IS 'Default kategori for varelinjer: varesalg, drift, anlæg, abonnement, lager, udlejning';
COMMENT ON COLUMN supplier_invoice_templates.default_product_group_number IS 'Default e-conomic produktgruppe nummer';

-- Add index for category lookups
CREATE INDEX IF NOT EXISTS idx_supplier_invoice_templates_category ON supplier_invoice_templates(default_product_category);
