from routers.router import Router


def print_firewall_rule(rule_data):
    print(f"{rule_data['type'].upper()} - {rule_data['interface']} - {rule_data['descr']}")
    print(f"Source: {rule_data['source']}")
    print(f"Destination: {rule_data['destination']}")
    if "disabled" in rule_data:
        print("DISABLED")
    print("-" * 50)


def show_firewall_rules_for_alias(router: Router, alias_name):
    result = router.client.get_firewall_rules()
    for item in result.data:
        if alias_name in item["source"].values() or alias_name in item["destination"].values():
            print_firewall_rule(item)
