// Copyright 2024 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0

// re-export to not break existing imports
pub use deprecated::*;
pub use nyx::*;
pub use wireguard::*;

// all of those should be obtained via nym-node, et al. crate instead
pub mod deprecated {
    pub const DEFAULT_MIX_LISTENING_PORT: u16 = 1789;

    // 'GATEWAY'
    pub const DEFAULT_CLIENT_LISTENING_PORT: u16 = 9000;

    // 'MIXNODE'
    pub const DEFAULT_VERLOC_LISTENING_PORT: u16 = 1790;
    pub const DEFAULT_HTTP_API_LISTENING_PORT: u16 = 8000;

    // 'CLIENT'
    pub const DEFAULT_WEBSOCKET_LISTENING_PORT: u16 = 1977;

    // 'SOCKS5' CLIENT
    pub const DEFAULT_SOCKS5_LISTENING_PORT: u16 = 1080;

    // NYM-API
    pub const DEFAULT_NYM_API_PORT: u16 = 8080;

    pub const NYM_API_VERSION: &str = "v1";

    // NYM-NODE
    pub const DEFAULT_NYM_NODE_HTTP_PORT: u16 = 8080;
}

pub mod nyx {
    /// Defaults Cosmos Hub/ATOM path
    pub const COSMOS_DERIVATION_PATH: &str = "m/44'/118'/0'/0/0";

    // as set by validators in their configs
    // (note that the 'amount' postfix is relevant here as the full gas price also includes denom)
    pub const GAS_PRICE_AMOUNT: f64 = 0.025;

    // TODO: is there a way to get this from the chain
    pub const TOTAL_SUPPLY: u128 = 1_000_000_000_000_000;
}

pub mod wireguard {
    use std::net::{Ipv4Addr, Ipv6Addr};

    pub const WG_TUNNEL_PORT: u16 = 51822;
    pub const WG_METADATA_PORT: u16 = 51830;

    // The interface used to route traffic
    pub const WG_TUN_BASE_NAME: &str = "nymwg";
    pub const WG_TUN_DEVICE_ADDRESS: &str = "10.1.0.1";
    pub const WG_TUN_DEVICE_IP_ADDRESS_V4: Ipv4Addr = Ipv4Addr::new(10, 1, 0, 1);
    pub const WG_TUN_DEVICE_NETMASK_V4: u8 = 16;
    pub const WG_TUN_DEVICE_IP_ADDRESS_V6: Ipv6Addr = Ipv6Addr::new(0xfc01, 0, 0, 0, 0, 0, 0, 0x1); // fc01::1
    pub const WG_TUN_DEVICE_NETMASK_V6: u8 = 112;
}

pub mod mixnet_vpn {
    use std::net::{Ipv4Addr, Ipv6Addr};

    // The interface used to route traffic
    pub const NYM_TUN_BASE_NAME: &str = "nymtun";
    pub const NYM_TUN_DEVICE_ADDRESS_V4: Ipv4Addr = Ipv4Addr::new(10, 0, 0, 1);
    pub const NYM_TUN_DEVICE_NETMASK_V4: Ipv4Addr = Ipv4Addr::new(255, 255, 0, 0);
    pub const NYM_TUN_DEVICE_ADDRESS_V6: Ipv6Addr = Ipv6Addr::new(0xfc00, 0, 0, 0, 0, 0, 0, 0x1); // fc00::1
    pub const NYM_TUN_DEVICE_NETMASK_V6: &str = "112";
}
