import { AdaptElement, Handle, PrimitiveComponent, WithChildren } from "@adpt/core";
/**
 * Port for {@link NetworkService }
 * @public
 */
export declare type ServicePort = number | string;
/**
 * Network service scope used by {@link NetworkService}
 * @public
 */
export declare type NetworkServiceScope = "local" | "cluster-internal" | "cluster-public" | "external";
/**
 * Props for the {@link NetworkService} element
 * @public
 */
export interface NetworkServiceProps extends WithChildren {
    /** IP address of the network service */
    ip?: string;
    /** Name of the network service */
    name?: string;
    /** Port on which clients connect to this service */
    port: ServicePort;
    /** Protocol used by the network service */
    protocol?: string;
    /** Scope of the service */
    scope?: NetworkServiceScope;
    /** Port on the endpoint that provides this service */
    targetPort?: ServicePort;
    /** Endpoint that provides the service */
    endpoint?: Handle;
}
/**
 * Type for various network address scopes
 *
 * @remarks
 * The details of this type are very experimental.  Use the constants `NetworkScope.external`
 * and `NetworkScope.default` instead of strings to reduce the chance of breakage.
 *
 * @beta
 */
export declare enum NetworkScope {
    external = "external",
    default = "default"
}
/**
 * Interface for components that expose Network Services via hostname and port
 *
 * @beta
 */
export interface NetworkServiceInstance {
    /**
     * Returns the hostname for the service from the given scope
     *
     * @param scope - the scope of the desired hostname ("default" cluster/internal, "external" - world accessible)
     * @returns - the requested hostname, or undefined if it is not yet available
     *
     * @remarks
     * This function should return the external, world accessible name if there is no cluster/internal only name.
     * The function should throw an error if an external name is requested, but no name/address is available
     * (e.g., the service is internally acessible only.)
     */
    hostname(scope?: NetworkScope): string | undefined;
    /**
     * Returns the TCP or UDP port of the exposed service
     *
     * @remarks
     * Will return undefined if the port information is not yet available
     */
    port(): number | undefined;
}
/**
 * An abstract component that represents a network service.
 *
 * @public
 */
export declare abstract class NetworkService extends PrimitiveComponent<NetworkServiceProps> implements NetworkServiceInstance {
    static defaultProps: {
        protocol: string;
        scope: string;
    };
    /**
     * Returns the hostname of the NetworkService, once it is known.
     */
    hostname(scope: NetworkScope): string | undefined;
    /**
     * Returns the port number of the NetworkService, once it is known.
     */
    port(): number | undefined;
}
export default NetworkService;
/**
 * Computes the target port that will be used for a NetworkService
 *
 * @param elemOrProps - a {@link NetworkService} element or its props
 * @returns The target port of the {@link NetworkService} object
 *
 * @public
 */
export declare function targetPort(elemOrProps: NetworkServiceProps | AdaptElement): ServicePort;
/**
 * Type assertion that tests an element to see if it is a {@link NetworkService}
 *
 * @param el - the element to be tested
 * @returns `true` if  `el` is a NetworkService, `false` otherwise
 *
 * @remarks
 * Also functions as a type assertion for Typescript, so the arguments
 * type will be adjusted to reflect that it is an `AdaptElement<NetworkServiceProps>`
 * instead of a generic `AdaptElement`.
 *
 * @public
 */
export declare function isNetworkServiceElement(el: AdaptElement): el is AdaptElement<NetworkServiceProps>;
//# sourceMappingURL=NetworkService.d.ts.map