-- Global royalty configuration (single active row enforced in application layer)
CREATE TABLE IF NOT EXISTS global_royalty_settings (
  id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  per_stream_royalty DECIMAL(12,4) NOT NULL DEFAULT 0.0000,
  annual_collaboration_commission DECIMAL(8,2) NOT NULL DEFAULT 0.00,
  created_by INT NULL,
  updated_by INT NULL,
  created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

INSERT INTO global_royalty_settings (per_stream_royalty, annual_collaboration_commission)
SELECT 0.0000, 0.00
FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM global_royalty_settings LIMIT 1);
