"""Canonical platform hostnames from short refs.

DNS uses a single subdomain level under the apex (``proj-<project_ref>.<apex>``) so
Cloudflare/customer zones can use one wildcard (e.g. ``*.app.p2hs.com``) without
``tenant.project.apex`` chaining.
"""
from __future__ import annotations


def canonical_live_url(project_ref: str, apex: str) -> str:
    a = (apex or "sites.p2hs.com").strip().lower().rstrip(".")
    return f"https://proj-{project_ref}.{a}/"


def canonical_preview_url(project_ref: str, apex: str) -> str:
    a = (apex or "sites.p2hs.com").strip().lower().rstrip(".")
    return f"https://prev-{project_ref}.{a}/"
