-- Create kiosk_settings table to store kiosk configuration
CREATE TABLE IF NOT EXISTS kiosk_settings (
  id SERIAL PRIMARY KEY,
  setting_key VARCHAR(255) UNIQUE NOT NULL,
  setting_value TEXT,
  description TEXT,
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

-- Create index on setting_key for faster lookups
CREATE INDEX IF NOT EXISTS idx_kiosk_settings_key ON kiosk_settings(setting_key);

-- Insert default settings
INSERT INTO kiosk_settings (setting_key, setting_value, description) VALUES
  ('excluded_company_ids', '29861361', 'Comma-separated list of company IDs to exclude from kiosk (co-managed clients)'),
  ('cycle_interval', '7', 'Default cycle interval in seconds (3-15)'),
  ('refresh_interval', '60', 'Data refresh interval in seconds'),
  ('show_rmm_alerts', 'false', 'Whether to show RMM alert tickets')
ON CONFLICT (setting_key) DO NOTHING;

-- Add comment to table
COMMENT ON TABLE kiosk_settings IS 'Configuration settings for the executive kiosk dashboard';
