package com.optix.android.data.local.entities

import androidx.room.Entity
import androidx.room.PrimaryKey

/**
 * Persistent audit record for every tool execution.
 * Secret values (passwords, API keys) MUST never be written here — callers
 * are responsible for stripping sensitive params before persisting.
 */
@Entity(tableName = "audit_log")
data class AuditLogEntity(
    @PrimaryKey(autoGenerate = true) val id: Long = 0,
    val toolName: String,
    val toolDisplayName: String,
    val paramsJson: String,        // Map<String, String> serialised as JSON (secrets stripped)
    val target: String?,
    val userId: String?,           // scenario / operator id if available
    val timestamp: Long,
    val success: Boolean,
    val errorMessage: String?,
    val durationMs: Long,
)
