/**
 * Pure, canonical IPv4 and IPv6 network prefixes using CIDR notation.
 *
 * @since 4.0.0
 */
import * as Equal from "../../Equal.ts";
import * as Hash from "../../Hash.ts";
import * as Result from "../../Result.ts";
import * as IpInterface from "./IpInterface.ts";
import * as NetAddress from "./NetAddress.ts";
declare const TypeId: "~effect/net/IpNetwork";
/**
 * An immutable canonical IP network prefix.
 *
 * @category models
 * @since 4.0.0
 */
export interface IpNetwork<out A extends NetAddress.IpAddress = NetAddress.IpAddress> extends Equal.Equal, Hash.Hash {
    readonly _tag: "IpNetwork";
    readonly address: A;
    readonly prefixLength: number;
    readonly [TypeId]: typeof TypeId;
    toString(): string;
    toJSON(): string;
}
/**
 * An immutable canonical IPv4 network prefix.
 *
 * @category models
 * @since 4.0.0
 */
export type Ipv4Network = IpNetwork<NetAddress.Ipv4Address>;
/**
 * An immutable canonical IPv6 network prefix.
 *
 * @category models
 * @since 4.0.0
 */
export type Ipv6Network = IpNetwork<NetAddress.Ipv6Address>;
/**
 * Returns `true` when a value is an IPv4 network prefix.
 *
 * @category guards
 * @since 4.0.0
 */
export declare const isIpv4Network: (u: unknown) => u is Ipv4Network;
/**
 * Returns `true` when a value is an IPv6 network prefix.
 *
 * @category guards
 * @since 4.0.0
 */
export declare const isIpv6Network: (u: unknown) => u is Ipv6Network;
/**
 * Returns `true` when a value is an IPv4 or IPv6 network prefix.
 *
 * @category guards
 * @since 4.0.0
 */
export declare const isIpNetwork: (u: unknown) => u is IpNetwork;
/**
 * Creates a network prefix when the address has no host bits set.
 *
 * **Gotchas**
 *
 * Use {@link fromAddress} when a host address should be truncated to its containing network.
 *
 * @category constructors
 * @since 4.0.0
 */
export declare const make: <A extends NetAddress.IpAddress>(address: A, prefixLength: number) => Result.Result<IpNetwork<A>, NetAddress.NetAddressError>;
/**
 * Creates the canonical network containing an address by clearing its host bits.
 *
 * **Gotchas**
 *
 * The returned network's address can differ from the input address.
 *
 * @category constructors
 * @since 4.0.0
 */
export declare const fromAddress: <A extends NetAddress.IpAddress>(address: A, prefixLength: number) => Result.Result<IpNetwork<A>, NetAddress.NetAddressError>;
/**
 * Returns the canonical network containing an interface address.
 *
 * @category conversions
 * @since 4.0.0
 */
export declare const fromInterface: <A extends NetAddress.IpAddress>(self: IpInterface.IpInterface<A>) => IpNetwork<A>;
/**
 * Parses a strict IPv4 network prefix in CIDR notation.
 *
 * @category decoding
 * @since 4.0.0
 */
export declare const ipv4FromString: (input: string) => Result.Result<Ipv4Network, NetAddress.NetAddressError>;
/**
 * Parses a strict IPv6 network prefix in CIDR notation.
 *
 * @category decoding
 * @since 4.0.0
 */
export declare const ipv6FromString: (input: string) => Result.Result<Ipv6Network, NetAddress.NetAddressError>;
/**
 * Parses a strict IPv4 or IPv6 network prefix in CIDR notation.
 *
 * @category decoding
 * @since 4.0.0
 */
export declare const fromString: (input: string) => Result.Result<IpNetwork, NetAddress.NetAddressError>;
/**
 * Creates a trusted network prefix, throwing when its address or prefix is invalid.
 *
 * @category unsafe
 * @since 4.0.0
 */
export declare const makeUnsafe: <A extends NetAddress.IpAddress>(address: A, prefixLength: number) => IpNetwork<A>;
/**
 * Creates the network containing a trusted address, throwing when its prefix is invalid.
 *
 * @category unsafe
 * @since 4.0.0
 */
export declare const fromAddressUnsafe: <A extends NetAddress.IpAddress>(address: A, prefixLength: number) => IpNetwork<A>;
/**
 * Parses a trusted network prefix in CIDR notation, throwing on failure.
 *
 * @category unsafe
 * @since 4.0.0
 */
export declare const fromStringUnsafe: (input: string) => IpNetwork;
/**
 * Formats a network prefix using canonical address text and its decimal prefix length.
 *
 * @category encoding
 * @since 4.0.0
 */
export declare const format: (self: IpNetwork) => string;
/**
 * Returns the lowest address in a network prefix.
 *
 * @category getters
 * @since 4.0.0
 */
export declare const firstAddress: <A extends NetAddress.IpAddress>(self: IpNetwork<A>) => A;
/**
 * Returns the numerically greatest address in a network prefix.
 *
 * @category getters
 * @since 4.0.0
 */
export declare const lastAddress: <A extends NetAddress.IpAddress>(self: IpNetwork<A>) => A;
/**
 * Returns the exact number of addresses in a network prefix.
 *
 * @category getters
 * @since 4.0.0
 */
export declare const addressCount: (self: IpNetwork) => bigint;
/**
 * Returns `true` when a network prefix contains an IP address.
 *
 * @category predicates
 * @since 4.0.0
 */
export declare const contains: {
    /**
     * Returns `true` when a network prefix contains an IP address.
     *
     * @category predicates
     * @since 4.0.0
     */
    (address: NetAddress.IpAddress): (self: IpNetwork) => boolean;
    /**
     * Returns `true` when a network prefix contains an IP address.
     *
     * @category predicates
     * @since 4.0.0
     */
    (self: IpNetwork, address: NetAddress.IpAddress): boolean;
};
/**
 * Returns `true` when a network prefix contains every address in another network prefix.
 *
 * @category predicates
 * @since 4.0.0
 */
export declare const containsNetwork: {
    /**
     * Returns `true` when a network prefix contains every address in another network prefix.
     *
     * @category predicates
     * @since 4.0.0
     */
    (other: IpNetwork): (self: IpNetwork) => boolean;
    /**
     * Returns `true` when a network prefix contains every address in another network prefix.
     *
     * @category predicates
     * @since 4.0.0
     */
    (self: IpNetwork, other: IpNetwork): boolean;
};
/**
 * Returns `true` when two network prefixes contain at least one common address.
 *
 * @category predicates
 * @since 4.0.0
 */
export declare const overlaps: {
    /**
     * Returns `true` when two network prefixes contain at least one common address.
     *
     * @category predicates
     * @since 4.0.0
     */
    (other: IpNetwork): (self: IpNetwork) => boolean;
    /**
     * Returns `true` when two network prefixes contain at least one common address.
     *
     * @category predicates
     * @since 4.0.0
     */
    (self: IpNetwork, other: IpNetwork): boolean;
};
export {};
//# sourceMappingURL=IpNetwork.d.ts.map