package layoutvalidationviewv1

import (
	"crypto/sha256"
	"encoding/hex"
)

// ViewDigest returns the exact content identity of the complete canonical v1
// view. Detached proof receipts, source paths, and selection state are absent.
func ViewDigest(view View) (string, error) {
	canonical, err := CanonicalViewBytes(view)
	if err != nil {
		return "", err
	}
	digest := sha256.Sum256(canonical)
	return "sha256:" + hex.EncodeToString(digest[:]), nil
}
