// Copyright (c) 2024 Cyprien Avico avicocyprien@yahoo.com
//
// Licensed under the MIT License <LICENSE-MIT or http://opensource.org/licenses/MIT>.
// This file may not be copied, modified, or distributed except according to those terms.

use bitcoin::BitcoinPacket;
use copt::CotpHeader;
use dhcp::DhcpPacket;
use dhcpv6::Dhcpv6Packet;
use dns::DnsPacket;
use ethernet_ip::EtherNetIpPacket;
use http::HttpRequest;
use modbus_tcp::ModbusTcpPacket;
use mqtt::MqttPacket;
use ntp::NtpPacket;
use opcua::OpcuaPacket;
use postgresql::PostgreSqlPacket;
use s7comm::S7CommPacket;
use snmp::SnmpPacket;
use tls::TlsPacket;

use crate::parse::application::protocols::{
    giop::GiopPacket, quic::QuicPacket, srvloc::SrvlocPacket,
};

pub mod ams;
pub mod bitcoin;
pub mod copt;
pub mod dhcp;
pub mod dhcpv6;
pub mod dns;
pub mod ethernet_ip;
pub mod giop;
pub mod http;
pub mod modbus_tcp;
pub mod mqtt;
pub mod ntp;
pub mod opcua;
pub mod postgresql;
pub mod quic;
pub mod s7comm;
pub mod snmp;
pub mod srvloc;
pub mod tls;

/// The `ApplicationProtocol` enum represents the possible layer 7 information that can be parsed.
#[derive(Debug)]
pub enum ApplicationProtocol<'a> {
    Ntp(NtpPacket),
    Tls(TlsPacket<'a>),
    Http(HttpRequest),
    Mqtt(MqttPacket),
    Dhcp(DhcpPacket),
    Dhcpv6(Dhcpv6Packet<'a>),
    Bitcoin(BitcoinPacket),
    Dns(DnsPacket),
    EtherNetIp(EtherNetIpPacket<'a>),
    S7Comm(S7CommPacket<'a>),
    Snmp(SnmpPacket<'a>),
    Cotp(CotpHeader),
    Quic(QuicPacket),
    Giop(GiopPacket),
    Srvloc(SrvlocPacket),
    Ams(ams::AmsPacket<'a>),
    ModbusTcp(ModbusTcpPacket<'a>),
    Opcua(OpcuaPacket<'a>),
    PostgreSql(PostgreSqlPacket<'a>),
    Raw(&'a [u8]),
    None,
}
