
import Foundation

final class HeavyAimControl {

    static let shared = HeavyAimControl()

    private(set) var isEnabled = false

    private(set) var settings: [String: Double] = [
        "aimWeight": 0.90,
        "movementResistance": 0.85,
        "trackingStability": 0.95,
        "dragResistance": 0.90,
        "movementSmoothing": 0.85,
        "responseControl": 0.80
    ]

    func enable() {
        isEnabled = true
    }

    func disable() {
        isEnabled = false
    }

    func configure(
        aimWeight: Double,
        movementResistance: Double,
        trackingStability: Double,
        dragResistance: Double,
        movementSmoothing: Double,
        responseControl: Double
    ) {
        settings["aimWeight"] = clamp(aimWeight)
        settings["movementResistance"] = clamp(movementResistance)
        settings["trackingStability"] = clamp(trackingStability)
        settings["dragResistance"] = clamp(dragResistance)
        settings["movementSmoothing"] = clamp(movementSmoothing)
        settings["responseControl"] = clamp(responseControl)
    }

    func getSettings() -> [String: Double] {
        return settings
    }

    private func clamp(_ value: Double) -> Double {
        return min(max(value, 0.0), 1.0)
    }
}
