"""
Integrity suite receipt: a single audit record over multiple subsystems.
"""
from __future__ import annotations

from datetime import datetime, timezone
from typing import Any, Dict, List, Optional

from receipts.base import BaseReceipt


class IntegrityCheckReceipt(BaseReceipt):
    """
    Unified integrity check across subsystems (voice, brainstem, entropy, etc.).
    """

    receipt_type: str = "IntegrityCheckReceipt"
    domain: str = "governance"
    organ: str = "integrity_suite"
    check_id: str
    subsystems: List[str]
    passed: bool
    failures: List[str]
    metrics: Dict[str, Any]

    def __init__(
        self,
        *,
        check_id: str,
        subsystems: List[str],
        passed: bool,
        failures: List[str],
        metrics: Dict[str, Any],
        ts: Optional[datetime] = None,
        parent_ids: Optional[List[str]] = None,
        **kwargs: Any,
    ):
        ts = ts or datetime.now(timezone.utc)
        super().__init__(
            receipt_id=check_id,
            check_id=check_id,
            subsystems=subsystems,
            passed=passed,
            failures=failures,
            metrics=metrics,
            ts=ts,
            parent_ids=parent_ids or [],
            **kwargs,
        )
