#!/usr/bin/env node
// Run from hk-planner/ dir: DATABASE_URL=... node seed-app.js
import pg from 'pg'

const { Pool } = pg
const pool = new Pool({ connectionString: process.env.DATABASE_URL })

await pool.query(`
  INSERT INTO apps (slug, name, description, base_path, icon, theme_color, category, internal_host, internal_port)
  VALUES ('hk-planner', 'Rota Check', 'Housekeeping workload and hours planning', '/hk-planner', 'CalendarClock', '#2d6a4f', 'Housekeeping', '10.10.10.118', 3080)
  ON CONFLICT (slug) DO UPDATE SET
    name          = EXCLUDED.name,
    description   = EXCLUDED.description,
    base_path     = EXCLUDED.base_path,
    icon          = EXCLUDED.icon,
    theme_color   = EXCLUDED.theme_color,
    category      = EXCLUDED.category,
    internal_host = EXCLUDED.internal_host,
    internal_port = EXCLUDED.internal_port
`)

console.log('hk-planner app seeded.')
await pool.end()
