require("dotenv").config();

function bool(value, fallback) {
  if (value === undefined) return fallback;
  return String(value).toLowerCase() === "true";
}

module.exports = {
  apiUrl: (process.env.EUROTRANS_API_URL || "http://127.0.0.1:4000").replace(/\/+$/, ""),

  telemetryUrl: process.env.LAUNCHER_TELEMETRY_URL || "http://127.0.0.1:25555/api/ets2/telemetry",

  heartbeatIntervalMs: Number(process.env.LAUNCHER_HEARTBEAT_INTERVAL_MS || 30000),
  telemetryIntervalMs: Number(process.env.LAUNCHER_TELEMETRY_INTERVAL_MS || 10000),
  launcherVersion: process.env.LAUNCHER_VERSION || "1.0.0",

  autoAcceptContracts: bool(process.env.LAUNCHER_AUTO_ACCEPT_CONTRACTS, true)
};
