#!/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_camera_scan


class CameraScanSkill(BaseSkill):
    """摄像头扫描Skill"""
    
    def get_metadata(self):
        return {
            "name": "camera_scan",
            "display_name": "摄像头扫描",
            "description": "扫描网络中的摄像头设备(海康/大华/宇视等)",
            "category": "advanced",
            "keywords": ["摄像头", "camera", "扫描", "监控", "海康", "大华"],
            "parameters": [
                {
                    "name": "network",
                    "type": "string",
                    "required": True,
                    "description": "网段,格式:192.168.1.0/24"
                }
            ],
            "examples": [
                "扫描192.168.1.0/24的摄像头",
                "查找局域网的监控摄像头"
            ],
            "requires_admin": False,
            "requires_ui": False
        }
    
    def execute(self, network: str) -> str:
        """执行摄像头扫描"""
        return run_camera_scan(network)
