import { Configuration, App } from './@types/app.mjs';
import { config } from './@types/wifi/config.mjs';
import { state } from './@types/wifi/state.mjs';
import { AP } from './@types/wifi/AP.mjs';
import { LanHost } from './@types/lan/host.mjs';
import { LanInterface } from './@types/lan/interfaces.mjs';
import { LanConfig } from './@types/lan/config.mjs';
import { Response, VoidResponse } from './@types/index.mjs';
import { ConnectionStatus } from './@types/connection/status.mjs';
import { ConnectionConfig, IPv6ConnectionConfiguration } from './@types/connection/config.mjs';
import Port from './@types/port.mjs';

declare class Submodule {
    private _freebox;
    baseUrl: string;
    token: string;
    constructor(freebox: Freebox);
}

declare class Wifi extends Submodule {
    constructor(freebox: Freebox);
    config(): Promise<Response<config>>;
    state(): Promise<Response<state>>;
    AP<T = AP[]>(id?: number): Promise<Response<T>>;
    BSS(): Promise<Response<any>>;
}

/**
 * Lan browser API allow you to discover hosts on the local network
 * @link https://mafreebox.freebox.fr/doc/index.html#lan-browser-api
 * @class LAN
 * @extends Submodule
 */
declare class LAN extends Submodule {
    constructor(freebox: Freebox);
    /**
     * Returns the current LanConfig
     * @link https://mafreebox.freebox.fr/doc/index.html#get-the-current-lan-configuration
     * @returns {Promise<Response<LanConfig>>}
     */
    config(): Promise<Response<LanConfig>>;
    /**
     * Update the current LanConfig
     * @link https://mafreebox.freebox.fr/doc/index.html#update-the-current-lan-configuration
     * @param config The new partial LanConfig
     * @returns {Promise<Response<Partial<LanConfig>>>}
     */
    update(config: Partial<LanConfig>): Promise<Response<Partial<LanConfig>>>;
    /**
     * Getting the list of browsable LAN interfaces
     * @link https://mafreebox.freebox.fr/doc/index.html#getting-the-list-of-browsable-lan-interfaces
     * @returns {Promise<Response<LanInterface[]>>}
     */
    interfaces(): Promise<Response<LanInterface[]>>;
    /**
     * Getting the list of hosts on a given interface
     * @link https://mafreebox.freebox.fr/doc/index.html#getting-the-list-of-hosts-on-a-given-interface
     * @param _interface Returns the list of LanHost on this interface
     * @returns {Promise<Response<LanHost[]>>}
     */
    hosts(_interface?: string): Promise<Response<LanHost[]>>;
    /**
     * Getting an host information
     * @link https://mafreebox.freebox.fr/doc/index.html#getting-an-host-information
     * @param _interface - The interface to which the host is connected
     * @param id - The id of the host
     * @returns {Promise<Response<LanHost>>}
     */
    host(_interface: string, id: string): Promise<Response<LanHost>>;
    /**
     * Updating an host information
     * @link https://mafreebox.freebox.fr/doc/index.html#updating-an-host-information
     * @param _interface The interface to which the host is connected
     * @param id The id of the host
     * @param data The data to update
     * @returns {Promise<Response<Partial<LanHost>>>}
     */
    updateHost(_interface: string, id: string, data: Partial<Omit<LanHost, "id">> & Required<Pick<LanHost, "id">>): Promise<Response<Partial<LanHost>>>;
    /**
     * Send a wake on LAN packet to the specified host with an optional password
     * @link https://mafreebox.freebox.fr/doc/index.html#send-wake-ok-lan-packet-to-an-host
     * @param _interface The interface to which the host is connected
     * @param mac The MAC address of the host
     * @param password - [OPTIONAL] The password to use to send the WOL packet
     * @returns
     */
    WOL(_interface: string, mac: string, password?: string): Promise<VoidResponse>;
}

declare class Connection extends Submodule {
    constructor(freebox: Freebox);
    /**
     * Get the current Connection status
     * @link https://mafreebox.freebox.fr/doc/index.html?v=b828168f17942dd3e241fff4f01ccdd14bcc89aa#connection-status-object
     * @returns {Promise<Response<ConnectionStatus>>}
     */
    status(): Promise<Response<ConnectionStatus>>;
    /**
     * Get the current Connection configuration
     * @link https://mafreebox.freebox.fr/doc/index.html?v=b828168f17942dd3e241fff4f01ccdd14bcc89aa#get-the-current-connection-configuration
     * @returns {Promise<Response<ConnectionConfig>>}
     */
    config(): Promise<Response<ConnectionConfig>>;
    /**
     * Update the Connection configuration
     * @link https://mafreebox.freebox.fr/doc/index.html?v=b828168f17942dd3e241fff4f01ccdd14bcc89aa#update-the-connection-configuration
     * @param body The new configuration
     * @returns {Promise<Response<ConnectionConfig>>}
     */
    updateConfig(body: Partial<ConnectionConfig>): Promise<Response<ConnectionConfig>>;
    /**
     * Get the current IPv6 Connection configuration
     * @link https://mafreebox.freebox.fr/doc/index.html?v=b828168f17942dd3e241fff4f01ccdd14bcc89aa#get-the-current-ipv6-connection-configuration
     * @returns {Promise<Response<IPv6ConnectionConfiguration>>}
     */
    IPv6config(): Promise<Response<IPv6ConnectionConfiguration>>;
    /**
     * Update the IPv6 Connection configuration
     * @link https://mafreebox.freebox.fr/doc/index.html?v=b828168f17942dd3e241fff4f01ccdd14bcc89aa#update-the-ipv6-connection-configuration
     * @param body The new configuration
     * @returns {Promise<Response<IPv6ConnectionConfiguration>>}
     */
    updateIPv6Config(body: Partial<IPv6ConnectionConfiguration>): Promise<Response<IPv6ConnectionConfiguration>>;
}

type TPort = Port;
declare class PortForwarding extends Submodule {
    constructor(freebox: Freebox);
    /**
     * Retrieves the status of a port or all ports.
     * @link https://mafreebox.freebox.fr/doc/index.html?v=b828168f17942dd3e241fff4f01ccdd14bcc89aa#getting-the-list-of-port-forwarding
     * @param id - The ID of the port to retrieve the status for. If not provided, retrieves the status of all ports.
     * @returns {Promise<Response<T>>}
     */
    status<T = TPort[]>(id?: number): Promise<Response<T>>;
    /**
     * Updating a port forwarding
     * @link https://mafreebox.freebox.fr/doc/index.html?v=b828168f17942dd3e241fff4f01ccdd14bcc89aa#updating-a-port-forwarding
     * @param id The id of the port to update
     * @param data The data to update
     * @returns {Promise<Response<T>>}
     */
    update(id: number, data: Partial<TPort>): Promise<Response<TPort>>;
    /**
     * Add a port forwarding
     * @link https://mafreebox.freebox.fr/doc/index.html?v=b828168f17942dd3e241fff4f01ccdd14bcc89aa#add-a-port-forwarding
     * @param data Add a port forwarding
     * @returns {Promise<Response<T>>}
     */
    add(data: Required<TPort>): Promise<Response<TPort>>;
    /**
     * Delete a port forwarding
     * @link https://mafreebox.freebox.fr/doc/index.html?v=b828168f17942dd3e241fff4f01ccdd14bcc89aa#delete-a-port-forwarding
     * @param id The id of the port to delete
     * @returns {Promise<VoidResponse>}
     */
    delete(id: number): Promise<VoidResponse>;
}

type OnLoginApp = Pick<App, "app_id" | "app_name" | "app_version" | "device_name" | "app_token">;
declare class Freebox {
    wifi: Wifi;
    LAN: LAN;
    connection: Connection;
    port: PortForwarding;
    private readonly logger;
    _configuration?: Configuration;
    _app: App;
    token: string;
    constructor(app: OnLoginApp);
    login(): Promise<void>;
}

export { Connection as C, Freebox as F, LAN as L, PortForwarding as P, Submodule as S, Wifi as W };
