
import Foundation

final class AimSmoothing {

    static let shared = AimSmoothing()

    private(set) var isEnabled = false

    private(set) var settings: [String: Double] = [
        "smoothingStrength": 0.85,
        "movementSmoothness": 0.80,
        "touchResponse": 0.75,
        "sensitivity": 0.65
    ]

    func enable() {
        isEnabled = true
    }

    func disable() {
        isEnabled = false
    }

    func configure(
        smoothingStrength: Double,
        movementSmoothness: Double,
        touchResponse: Double,
        sensitivity: Double
    ) {
        settings["smoothingStrength"] = clamp(smoothingStrength)
        settings["movementSmoothness"] = clamp(movementSmoothness)
        settings["touchResponse"] = clamp(touchResponse)
        settings["sensitivity"] = clamp(sensitivity)
    }

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

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