# region TestAuditService [TYPE Module]
# @RELATION DEPENDS_ON ->[AuditService]
# @SEMANTICS: tests, clean-release, audit, logging
# @PURPOSE: Validate audit hooks emit expected log patterns for clean release lifecycle.
# @LAYER Infrastructure

from unittest.mock import patch

from src.services.clean_release.audit_service import (
    audit_check_run,
    audit_preparation,
    audit_report,
)


@patch("src.services.clean_release.audit_service.logger")
# region test_audit_preparation [TYPE Function]
# @RELATION  BINDS_TO -> TestAuditService
# @PURPOSE: Verify audit preparation stage correctly initializes and validates candidate state.
def test_audit_preparation(mock_logger):
    audit_preparation("cand-1", "PREPARED")
    mock_logger.info.assert_called_with(
        "[REASON] clean-release preparation candidate=cand-1 status=PREPARED"
    )


# endregion test_audit_preparation


@patch("src.services.clean_release.audit_service.logger")
# region test_audit_check_run [TYPE Function]
# @RELATION  BINDS_TO -> TestAuditService
# @PURPOSE: Verify audit check run executes all checks and collects results.
def test_audit_check_run(mock_logger):
    audit_check_run("check-1", "COMPLIANT")
    mock_logger.info.assert_called_with(
        "[REFLECT] clean-release check_run=check-1 final_status=COMPLIANT"
    )


# endregion test_audit_check_run


@patch("src.services.clean_release.audit_service.logger")
# region test_audit_report [TYPE Function]
# @RELATION  BINDS_TO -> TestAuditService
# @PURPOSE: Verify audit report generation aggregates check results into a structured report.
def test_audit_report(mock_logger):
    audit_report("rep-1", "cand-1")
    mock_logger.info.assert_called_with(
        "[EXPLORE] clean-release report_id=rep-1 candidate=cand-1"
    )


# endregion test_audit_report
# endregion TestAuditService
