/**
 * `domains` namespace — ProjectDomain lifecycle.
 *
 * Domain operations are project-scoped control-plane actions. They use the
 * SDK credential provider's server auth (SIWX, control-plane session, or
 * grant key) and deliberately do not require local project-key cache entries.
 */
import type { Client } from "../kernel.js";
export type ProjectDomainStatus = "action_required" | "waiting" | "active" | "needs_repair" | "failed";
export type ProjectDomainReceiveStrategy = "auto" | "outbound_only" | "forwarding_mode" | "subdomain_mode" | "full_receive_takeover";
export type ProjectDomainMailboxAddressMode = "primary" | "alias" | "managed" | "none";
export type ProjectDomainActivationMode = "automatic_when_ready" | "manual";
export type ProjectDomainWaitUntil = "active" | "safe" | "receive-active";
export interface ProjectDomainMailboxAddressBinding {
    local_part: string;
    mailbox_slug: string;
    create_mailbox?: boolean;
}
/**
 * Declarable connect-time authority. `hosted_dns_zone` opts the domain into a
 * Run402-hosted DNS zone: the owner makes ONE nameserver change and Run402
 * applies every in-zone record (the only workable path for a root domain at
 * most registrars). Absent means manual DNS.
 */
export type ProjectDomainAuthorityIntent = "manual_dns" | "hosted_dns_zone";
export interface ProjectDomainDesired {
    authority?: ProjectDomainAuthorityIntent;
    web?: {
        enabled: boolean;
        target?: string;
        role?: "primary" | "alias";
    };
    email?: {
        send?: {
            enabled: boolean;
        };
        receive?: {
            enabled: boolean;
            strategy?: ProjectDomainReceiveStrategy;
            resolved_strategy?: ProjectDomainReceiveStrategy;
            observed_mx_fingerprint?: string;
            mail_subdomain?: string;
        };
        mailbox_addresses?: {
            mode: ProjectDomainMailboxAddressMode;
            addresses: ProjectDomainMailboxAddressBinding[];
        };
        activation?: ProjectDomainActivationMode;
    };
}
export interface ProjectDomainCheck {
    id: string;
    status: "unknown" | "pending" | "passed" | "failed" | "drifted" | "blocked";
    blocking: boolean;
    reason_code?: string;
    summary?: string;
    blocked_by?: string[];
    checked_at?: string;
}
export interface ProjectDomainDnsRecord {
    id: string;
    purpose: string;
    type: string;
    name: string;
    value: string;
    priority?: number;
    required: boolean;
    status: "unknown" | "missing" | "present" | "conflict";
    safety: {
        safe_to_auto_run: boolean;
        confirmation_required: boolean;
        destructive: boolean;
        external_required: boolean;
        conflict_policy?: string;
        [key: string]: unknown;
    };
    bind?: string;
}
export interface ProjectDomainNextAction {
    type: string;
    method?: string;
    path?: string;
    auth?: string;
    why?: string;
    safe_to_auto_run?: boolean;
    destructive?: boolean;
    confirmation_required?: boolean;
    external_required?: boolean;
    affected_record_ids?: string[];
    [key: string]: unknown;
}
export interface ProjectDomainReceiveTest {
    id: string;
    local_part: string;
    address: string;
    target_managed_address: string;
    token: string;
    status: "pending" | "passed" | "failed" | "stale";
    created_at: string;
    passed_at?: string | null;
}
export interface ProjectDomainHostedZone {
    dns_hosting: "run402_hosted";
    status: "provisioning" | "awaiting_delegation" | "delegated" | "releasing";
    /** The nameserver pair to set at the registrar — the one customer-side step. */
    ns_assigned: string[];
    /** Pre-existing MX/TXT copied into the zone before the change was recommended. */
    imported_records: Array<{
        type: string;
        name: string;
        value: string;
        priority?: number;
    }>;
}
export interface ProjectDomain {
    project_id: string;
    domain: string;
    status: ProjectDomainStatus;
    desired: ProjectDomainDesired;
    observed: Record<string, unknown>;
    effective: Record<string, unknown>;
    authority: {
        recommended_mode: string;
        options: Array<Record<string, unknown>>;
    };
    dns_records: ProjectDomainDnsRecord[];
    checks: ProjectDomainCheck[];
    /** Ordered follow-ups; `next_actions[0]` is the recommended action. */
    next_actions: ProjectDomainNextAction[];
    /** Present only for a domain on a Run402-hosted DNS zone. */
    hosted_zone?: ProjectDomainHostedZone | null;
    provenance: {
        project: "server_control_plane";
        desired: "server_control_plane";
        observed_dns: "public_dns_resolvers";
        effective: "run402_control_plane";
        local_cache: "not_used";
    };
    created_at?: string;
    updated_at?: string;
}
export interface ProjectDomainListResult {
    domains: ProjectDomain[];
}
export interface ProjectDomainConnectInput {
    /** The domain to connect, e.g. `example.com` or `app.example.com`. */
    domain: string;
    /** Desired web / email state for the domain. */
    desired: ProjectDomainDesired;
}
export interface ProjectDomainTestReceiveResult extends ProjectDomain {
    receive_test: ProjectDomainReceiveTest;
}
export interface ProjectDomainWaitOptions {
    until?: ProjectDomainWaitUntil;
    timeoutMs?: number;
    intervalMs?: number;
}
export type DomainRequestOptions = Record<string, never>;
export declare class Domains {
    private readonly client;
    constructor(client: Client);
    /**
     * Connect a custom domain to a project, or change what an already-connected
     * domain should serve: `POST /projects/v1/:project_id/domains { domain, desired }`.
     * Returns the ProjectDomain state with `dns_records` and `next_actions`.
     */
    connect(projectId: string, input: ProjectDomainConnectInput): Promise<ProjectDomain>;
    get(projectId: string, domain: string): Promise<ProjectDomain>;
    list(projectId: string): Promise<ProjectDomainListResult>;
    check(projectId: string, domain: string): Promise<ProjectDomain>;
    apply(projectId: string, domain: string): Promise<ProjectDomain>;
    repair(projectId: string, domain: string): Promise<ProjectDomain>;
    testReceive(projectId: string, domain: string, to: string): Promise<ProjectDomainTestReceiveResult>;
    activate(projectId: string, domain: string): Promise<ProjectDomain>;
    disconnect(projectId: string, domain: string): Promise<{
        status: string;
        domain: string;
    }>;
    wait(projectId: string, domain: string, opts?: ProjectDomainWaitOptions): Promise<ProjectDomain>;
}
//# sourceMappingURL=domains.d.ts.map