package com.optix.android.domain.model

// ---------------------------------------------------------------------------
// Tool metadata
// ---------------------------------------------------------------------------

data class ToolMetadata(
    val name: String,
    val displayName: String,
    val description: String,
    val category: ToolCategory,
    val parameters: List<ToolParam>,
    val requiresRoot: Boolean = false,
    val requiresNetwork: Boolean = true,
    val requiresTermux: Boolean = false,
    /**
     * Apt packages that must be present in Termux for this tool to run.
     * Used by [com.optix.android.domain.usecase.BootstrapCapabilities] to
     * install missing dependencies and by the execution engine for capability checks.
     */
    val requiredPackages: List<String> = emptyList(),
    val supportedPlatforms: List<String> = emptyList(),
    val apiKeyRef: String? = null,
    /** Suggested next tools to chain after this one */
    val chainSuggestions: List<String> = emptyList(),
)

data class ToolParam(
    val name: String,
    val type: ParamType,
    val description: String,
    val required: Boolean = true,
    val defaultValue: String? = null,
    val enumValues: List<String> = emptyList(),
)

enum class ParamType {
    STRING, INT, BOOLEAN, ENUM;

    fun jsonType(): String = when (this) {
        STRING  -> "string"
        INT     -> "integer"
        BOOLEAN -> "boolean"
        ENUM    -> "string"
    }
}

enum class ToolCategory(val displayName: String) {
    NETWORK_SCANNING("Network & Scanning"),
    DNS_WEB("DNS & Web"),
    EXPLOITATION("Exploitation"),
    PAYLOADS_UTILITIES("Payloads & Utilities"),
    LPE("Privilege Escalation"),
    LATERAL_MOVEMENT("Lateral Movement"),
    OSINT("OSINT & Intelligence"),
    AI_REDTEAM("AI Security & Red Team"),
    CLOUD_SEC("Cloud Security"),
    CONTAINER_SEC("Container & Kubernetes"),
    THREAT_INTEL("Threat Intelligence"),
}
