#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""DHCP检测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_dhcp_detection


class DhcpSkill(BaseSkill):
    """DHCP检测Skill"""
    
    def get_metadata(self):
        return {
            "name": "dhcp_detection",
            "display_name": "DHCP检测",
            "description": "检测网络中的DHCP服务器",
            "category": "advanced",
            "keywords": ["dhcp", "检测", "服务器"],
            "parameters": [
                {
                    "name": "interface",
                    "type": "string",
                    "required": False,
                    "default": "auto",
                    "description": "网卡名称或auto(自动检测)"
                }
            ],
            "examples": [
                "DHCP检测",
                "检测DHCP服务器"
            ],
            "requires_admin": True,
            "requires_ui": False
        }
    
    def execute(self, interface: str = "auto") -> str:
        """执行DHCP检测"""
        return run_dhcp_detection(interface)
