#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""路由表查看Skill"""

import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(__file__))))

from skills.base_skill import BaseSkill
from network_tools import run_route_table_view, run_arp_table_view


class RouteTableSkill(BaseSkill):
    """路由表查看Skill"""
    
    def get_metadata(self):
        return {
            "name": "route_table",
            "display_name": "路由表查看",
            "description": "查看系统路由表或ARP表",
            "category": "info",
            "keywords": ["路由", "route", "arp", "表", "查看"],
            "parameters": [
                {
                    "name": "table_type",
                    "type": "string",
                    "required": False,
                    "default": "route",
                    "description": "表类型:route(路由表)/arp(ARP表)"
                }
            ],
            "examples": [
                "查看路由表",
                "查看ARP表",
                "显示路由信息"
            ],
            "requires_admin": False,
            "requires_ui": False
        }
    
    def execute(self, table_type: str = "route") -> str:
        """查看路由表或ARP表"""
        table_type = table_type.lower()
        
        if table_type == "arp":
            return run_arp_table_view()
        else:
            return run_route_table_view()
