"""SHA-256 checksum calculation for scan records."""

from __future__ import annotations

import hashlib


def compute_scan_checksum(
    scan_id: str | int,
    timestamp: str,
    scanned_path: str,
    findings_json: str,
) -> str:
    """
    Compute SHA-256 of: id + timestamp + scanned_path + findings_json
    (all four fields concatenated, UTF-8 encoded).
    """
    raw = f"{scan_id}{timestamp}{scanned_path}{findings_json}"
    return hashlib.sha256(raw.encode("utf-8")).hexdigest()
