/** 内网宿主系统默认 Service Token（与 deploy/.env.bt-host-mysql.example 中 HOST_SERVICE_TOKENS key 一致） */
export const DEFAULT_HOST_SERVICE_TOKEN = "chajia-neibu-2026";

export const DEFAULT_HOST_CUSTOMER_ID = "CUST_001";

/** embed-demo 演示页 Token（构建时 NEXT_PUBLIC_* 可覆盖，默认与 DEFAULT_HOST_SERVICE_TOKEN 相同） */
export const EMBED_DEMO_SERVICE_TOKEN =
  process.env.NEXT_PUBLIC_EMBED_DEMO_SERVICE_TOKEN?.trim() ||
  DEFAULT_HOST_SERVICE_TOKEN;

export const EMBED_DEMO_CUSTOMER_ID =
  process.env.NEXT_PUBLIC_EMBED_DEMO_CUSTOMER_ID?.trim() ||
  DEFAULT_HOST_CUSTOMER_ID;

/**
 * 本地开发是否跳过宿主 Service Token 鉴权（quotes / priority1 / addresses 等）。
 * - production：始终 false
 * - development：默认 true；设 HOST_SERVICE_AUTH_DISABLED=false 可恢复校验
 */
export function isHostServiceAuthDisabled(): boolean {
  if (process.env.NODE_ENV === "production") {
    return false;
  }
  const raw = process.env.HOST_SERVICE_AUTH_DISABLED?.trim().toLowerCase();
  if (raw === "false" || raw === "0" || raw === "no") {
    return false;
  }
  if (raw === "true" || raw === "1" || raw === "yes") {
    return true;
  }
  return process.env.NODE_ENV === "development";
}
