"use strict";
// ─── Namespace queries ──────────────────────────────────────────────────────
Object.defineProperty(exports, "__esModule", { value: true });
exports.UPSERT_NAMESPACE = exports.GET_NAMESPACE_BY_NAME = exports.GET_DEFAULT_NAMESPACE = exports.LIST_NAMESPACES = void 0;
exports.LIST_NAMESPACES = `
  SELECT * FROM lt_namespaces
  ORDER BY is_default DESC, name ASC`;
exports.GET_DEFAULT_NAMESPACE = `
  SELECT * FROM lt_namespaces
  WHERE is_default = true
  LIMIT 1`;
exports.GET_NAMESPACE_BY_NAME = `
  SELECT * FROM lt_namespaces
  WHERE name = $1
  LIMIT 1`;
exports.UPSERT_NAMESPACE = `
  INSERT INTO lt_namespaces (name, schema_name, description, metadata)
  VALUES ($1, $2, $3, $4)
  ON CONFLICT (name) DO UPDATE SET
    description = COALESCE(EXCLUDED.description, lt_namespaces.description),
    metadata = COALESCE(EXCLUDED.metadata, lt_namespaces.metadata),
    updated_at = NOW()
  RETURNING *`;
