-- Phase 114-01: Seed default invoice config 'Domyslny VAT'.
-- Idempotent via NOT EXISTS guard (invoice_configs.name is not UNIQUE on purpose -
-- operators may want multiple configs with the same name across departments).
INSERT INTO `invoice_configs`
  (`name`, `number_format`, `numbering_type`, `sale_date_source`, `order_reference`, `payment_to_days`, `default_kind`, `is_delegated`, `is_active`)
SELECT 'Domyslny VAT', 'FV/%N/%M/%Y', 'monthly', 'issue_date', 'none', 7, 'vat', 0, 1
FROM dual
WHERE NOT EXISTS (
  SELECT 1 FROM `invoice_configs` WHERE `name` = 'Domyslny VAT'
);
