def parse_interface_data(data):
    interface_table = []
    current_interface_entry = None

    if "data" in data:
        raw_data = data["data"]

        for line in raw_data.split("\n"):
            if line.startswith("Interface") and "IP Address" in line:
                continue 
            if line.startswith("Codes:"):
                continue 
            if line.strip().startswith('-'): 
                continue
            if not line.strip():
                current_interface_entry = None
                continue

            if not line[0].isspace():
                interface_info = line.split()
                if len(interface_info) >= 6:
                    current_interface_entry = {
                        "interface": interface_info[0],
                        "ip_address": interface_info[1] if interface_info[1] != '-' else 'N/A',
                        "mac_address": interface_info[2],
                        "vrf": interface_info[3],
                        "mtu": interface_info[4],
                        "status": interface_info[5],
                        "description": " ".join(interface_info[6:]) 
                    }
                    interface_table.append(current_interface_entry)
                else:
                    current_interface_entry = None
            
            elif current_interface_entry and line[0].isspace():
                additional_ip = line.strip()
                
                if len(additional_ip.split()) == 1 and ('/' in additional_ip or ':' in additional_ip):
                    if current_interface_entry["ip_address"] == 'N/A':
                        current_interface_entry["ip_address"] = additional_ip
                    else:
                        current_interface_entry["ip_address"] += f"<br>{additional_ip}"
            
            else:
                current_interface_entry = None

    return interface_table