(ns ajet-chat.e2e.config)

;; ---------------------------------------------------------------------------
;; URLs — default to localhost test ports, override via env vars
;; ---------------------------------------------------------------------------

(def base-url
  "Auth gateway URL (entry point for all browser requests)."
  (or js/process.env.AJET_TEST_BASE_URL "http://localhost:4000"))

(def gitea-url
  "Gitea URL for API calls (user creation, OAuth app setup)."
  (or js/process.env.AJET_TEST_GITEA_URL "http://localhost:4080"))

(def api-url
  "Internal API URL (for direct API calls bypassing auth-gw)."
  (or js/process.env.AJET_TEST_API_URL "http://localhost:4001"))

;; ---------------------------------------------------------------------------
;; Database
;; ---------------------------------------------------------------------------

(def db-config
  {:host     (or js/process.env.AJET_TEST_DB_HOST "localhost")
   :port     (or js/process.env.AJET_TEST_DB_PORT "5433")
   :database (or js/process.env.AJET_TEST_DB_DBNAME "ajet_chat_test")
   :user     (or js/process.env.AJET_TEST_DB_USER "ajet")
   :password (or js/process.env.AJET_TEST_DB_PASSWORD "ajet_test")})

;; ---------------------------------------------------------------------------
;; Gitea credentials
;; ---------------------------------------------------------------------------

(def gitea-admin
  {:username "gitea-admin"
   :password "gitea-admin-pass"})

(def test-user-a
  {:username "testuser-a"
   :password "testpass-a"
   :email    "testuser-a@test.local"})

(def test-user-b
  {:username "testuser-b"
   :password "testpass-b"
   :email    "testuser-b@test.local"})

;; ---------------------------------------------------------------------------
;; Playwright
;; ---------------------------------------------------------------------------

(def headless?
  "Set HEADLESS=false to run browser visibly for debugging."
  (not= "false" (or js/process.env.HEADLESS "true")))

(def slow-mo
  "Milliseconds to slow down Playwright operations (useful for debugging)."
  (js/parseInt (or js/process.env.SLOW_MO "0") 10))

(def default-timeout
  "Default timeout for waitFor operations (ms)."
  15000)
