const ALLOWED_HOST_VALUES = [
  "tickets.esdrasrenan.com.br",
  "convex.esdrasrenan.com.br",
  "localhost",
  "localhost:3000",
  "127.0.0.1",
  "127.0.0.1:3000",
] as const

const ALLOWED_HOST_SET = new Set(ALLOWED_HOST_VALUES.map((host) => host.toLowerCase()))

export const ALLOWED_HOSTS = ALLOWED_HOST_VALUES

export function isAllowedHost(hostHeader: string | null | undefined): boolean {
  if (!hostHeader) {
    return false
  }

  return ALLOWED_HOST_SET.has(hostHeader.toLowerCase())
}
