import { env } from "cloudflare:workers";
import {
claimHost,
forgetDomainSite,
forgetSite,
hostHolder,
loadSiteRow,
registerDomainSite,
registerSite,
releaseHost,
siteDb,
} from "./store";
import { encryptSecret, randomId, randomToken } from "../crypto";
import { stmt } from "../scoped-db";
import { badRequest, conflict } from "../errors";
import { assertBelowCap } from "../limits";
import {
createCustomHostname,
customDomainsEnabled,
deleteCustomHostname,
domainStatus,
getCustomHostname,
} from "./domains";
import {
customHostKey,
isForgeRelatedHost,
isValidHostname,
metaKey,
publishMeta,
SITE_LIMITS,
sitesDomain,
} from "./config";
import { assertLabelFree, loadSiteForRepo, unpublishSite } from "./deploy";
import { siteLabel } from "./naming";
import { hashSitePassword } from "./password";
import { assertPublicHttps } from "./oidc";
import type { SiteAccess, SiteRow } from "./config";
import { assertCanAddCustomDomain, syncDomainAddonQuantity } from "../billing/domain-addon";
import type { RepoRow } from "~/lib/types";