"""
SOVR SDK Client v3.0.0
The Execution Firewall for AI Agents — Official Python SDK

Supports two API modes:
  - 'mcp'   → routes to /api/mcp/*  (default)
  - 'cloud' → routes to /api/sovr/v1/cloud/*
"""

import os
import time
import hashlib
import hmac
import json
from typing import Optional, Dict, Any, List, Callable, TypeVar, Awaitable
from functools import wraps

import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry

from .models import (
    GateCheckResult,
    ApprovalResult,
    PermitResult,
    ReceiptResult,
    ReplayResult,
    ExportBundleResult,
    StatusResult,
    ScanResult,
    QuickScanResult,
    ScanStats,
    KillSwitchStatus,
    KillSwitchTriggerResult,
    KillSwitchRecoverResult,
    PolicyValidateResult,
    PolicyVersionResult,
    # P1: Budget
    BudgetStatusResult,
    BudgetConsumeResult,
    BudgetHistoryResult,
    BudgetSetLimitResult,
    BudgetAlertResult,
    # P1: Audit
    AuditTrailResult,
    AuditChainVerifyResult,
    AuditStatsResult,
    AuditExportResult,
    # P1: Monitoring
    SystemHealthResult,
    MetricsResult,
    AlertsResult,
    AlertAckResult,
    # P2: p1p2 Cognitive Security
    EpistemicCheckResult,
    SubmitEvidenceResult,
    AdversarialDetectResult,
    NarrativeFilterResult,
    NarrativeRule,
    RealityCheckResult,
    SLAMetricsResult,
    ContextBundle,
    MemoryWriteResult,
    MemorySearchResult,
    PrecedentCheckResult,
    CostEventResult,
    CanaryLogResult,
    CanaryReplayResult,
    DegradationEntry,
    DegradationListResult,
    MetaSupervisionResult,
    FailureBudgetResult,
    LLMEvaluationResult,
    ReasoningAnalysisResult,
    # P2: p3Fusion Compliance & Governance
    DataAsset,
    DataClassifyResult,
    DataLineageResult,
    DataQualityResult,
    PIIDetectResult,
    MaskDataResult,
    ConsentCheckResult,
    PIAEntry,
    ComplianceCheckResult,
    ComplianceReportResult,
    GapAnalysisResult,
    QuotaCheckResult,
    AccessValidateResult,
    SubscriptionStatsResult,
    TrustScoreResult,
    TrustScoreHistoryResult,
    BatchScoreResult,
    RiskAssessResult,
    RiskDetectResult,
    IncidentReportResult,
    IncidentEntry,
    PolicyEntry,
    CreatePolicyResult,
    EvaluatePolicyResult,
    ConflictDetectResult,
    IntegrationRule,
    CreateIntegrationRuleResult,
    PublishEventResult,
    # P3: ModelOps
    ModelInfo,
    ModelSelectResult,
    CircuitBreakerEvent,
    ABTestInfo,
    PromptTemplateInfo,
    PromptRenderResult,
    RoutingDecisionInfo,
    ModelUsageStatsInfo,
    ModelHealthStatusInfo,
    # P3: TaskQueue
    TaskInfo,
    TaskQueueStatsInfo,
    # P3: Experiment
    ExperimentInfo,
    ExperimentAssignment,
    # P3: AuditRegression
    RegressionSuite,
    RegressionRun,
    # P3: AuditReplay
    SnapshotInfo,
    ReplaySessionInfo,
    SnapshotCompareResult,
    # P4: Extended models
    GateConfigResult,
    HighRiskActionInfo,
    PendingApprovalInfo,
    ApprovalDetailInfo,
    ApprovalStatsInfo,
    AuditChainResult,
    AuditDetailResult,
    DailyRootVerifyResult,
    DegradationStateResult,
    KillSwitchOperationCheck,
    TrustChainVerifyResult,
    EvidenceWriteResult,
    PolicyCompileResult,
    PolicyVersionInfo,
    PermissionCheckResult,
    RolePermissionsResult,
    DualApprovalCheckResult,
    ApprovalIsolationResult,
    BudgetStatusResult as BudgetStatusResultP4,
    BudgetProceedResult,
    BudgetHumanCheckResult,
    DefaultDenyOpResult,
    DefaultDenyAutoAdjustResult,
    KnownActionInfo,
    MeteringUsageResult,
    MeteringQuotaResult,
    MeteringDailyResult,
    MeteringSubscriptionResult,
    AlertRuleInfo,
    MetricHistoryResult,
    FeatureFlagInfo,
    CanaryDeploymentInfo,
    ApiKeyInfo,
    ApiKeyUsageResult,
    WebhookInfo,
    IntegrationListItem,
    TaskQueueStatsResult,
    DeadLetterItemInfo,
    ScanLogInfo,
    ScanStatsResult,
    ContentPatternInfo,
    CustomPatternInfo,
    GeoStatsResult,
    SemanticModelInfo,
)
from .exceptions import (
    SOVRError,
    AuthenticationError,
    ForbiddenError,
    RateLimitError,
    ValidationError,
    NotFoundError,
    ActionBlockedError,
    ApprovalRequiredError,
)

T = TypeVar("T")

SDK_VERSION = "3.0.0"

# Cloud API uses different path names than MCP API
_CLOUD_PATH_MAP = {
    "/gate-check": "/gate",
    "/request-approval": "/approval",
    "/grant-permit": "/grant-permit",
    "/submit-receipt": "/submit-receipt",
    "/replay-decision": "/replay-decision",
    "/export-bundle": "/export-bundle",
}

RETRYABLE_STATUS_CODES = [408, 429, 500, 502, 503, 504]


class SOVRClient:
    """
    SOVR API Client — The Execution Firewall for AI Agents.

    Provides gate-check, approval workflow, permit signing,
    receipt submission, decision replay, and trust bundle export.

    Example:
        >>> from sovr_sdk import SOVRClient
        >>> sovr = SOVRClient(
        ...     api_key="sovr_sk_...",
        ...     endpoint="https://sovr-ai-mkzgqqeh.manus.space",
        ... )
        >>> result = sovr.gate_check(
        ...     action="send_payment",
        ...     resource="stripe/charge",
        ...     context={"amount": 5000},
        ... )
        >>> if result.allowed:
        ...     print("Proceed with execution")
    """

    DEFAULT_TIMEOUT = 30
    DEFAULT_MAX_RETRIES = 2

    def __init__(
        self,
        api_key: Optional[str] = None,
        endpoint: Optional[str] = None,
        mode: Optional[str] = None,
        timeout: int = DEFAULT_TIMEOUT,
        max_retries: int = DEFAULT_MAX_RETRIES,
    ):
        """
        Initialize SOVR client.

        Args:
            api_key: API key (sovr_sk_...). Falls back to SOVR_API_KEY env var.
            endpoint: Base URL of the SOVR API. Falls back to SOVR_API_ENDPOINT env var.
            mode: API mode: 'mcp' (default) or 'cloud'. Falls back to SOVR_API_MODE env var.
            timeout: Request timeout in seconds (default: 30).
            max_retries: Maximum retry attempts for transient errors (default: 2).
        """
        self.api_key = api_key or os.environ.get("SOVR_API_KEY", "")
        self.endpoint = (endpoint or os.environ.get("SOVR_API_ENDPOINT", "")).rstrip("/")
        self.mode = mode or os.environ.get("SOVR_API_MODE", "mcp")
        self.timeout = timeout

        if not self.api_key:
            raise SOVRError("Missing API key. Pass api_key or set SOVR_API_KEY env var.", status_code=400, error_code="MISSING_API_KEY")
        if not self.endpoint:
            raise SOVRError("Missing endpoint. Pass endpoint or set SOVR_API_ENDPOINT env var.", status_code=400, error_code="MISSING_ENDPOINT")

        self.session = requests.Session()
        retry_strategy = Retry(
            total=max_retries,
            backoff_factor=0.5,
            status_forcelist=RETRYABLE_STATUS_CODES,
            allowed_methods=["HEAD", "GET", "POST", "PUT", "DELETE", "OPTIONS"],
        )
        adapter = HTTPAdapter(max_retries=retry_strategy)
        self.session.mount("http://", adapter)
        self.session.mount("https://", adapter)

    def _get_headers(self) -> Dict[str, str]:
        """Build request headers based on API mode."""
        headers = {
            "Content-Type": "application/json",
            "User-Agent": f"sovr-sdk-python/{SDK_VERSION}",
        }
        if self.mode == "cloud":
            headers["X-SOVR-API-Key"] = self.api_key
        else:
            headers["Authorization"] = f"Bearer {self.api_key}"
        return headers

    def _resolve_path(self, path: str) -> str:
        """Resolve API path based on mode."""
        if self.mode == "cloud":
            prefix = "/api/sovr/v1/cloud"
            resolved = _CLOUD_PATH_MAP.get(path, path)
        else:
            prefix = "/api/mcp"
            resolved = path
        return f"{prefix}{resolved}"

    def _request(
        self,
        method: str,
        path: str,
        data: Optional[Dict] = None,
        params: Optional[Dict] = None,
    ) -> Dict[str, Any]:
        """
        Send API request with error handling.

        Args:
            method: HTTP method
            path: API path (e.g. '/gate-check')
            data: Request body
            params: Query parameters

        Returns:
            Parsed JSON response

        Raises:
            AuthenticationError, ForbiddenError, NotFoundError,
            ValidationError, RateLimitError, SOVRError
        """
        url = f"{self.endpoint}{self._resolve_path(path)}"

        try:
            response = self.session.request(
                method=method,
                url=url,
                headers=self._get_headers(),
                json=data,
                params=params,
                timeout=self.timeout,
            )

            if response.status_code == 401:
                raise AuthenticationError()
            elif response.status_code == 403:
                raise ForbiddenError()
            elif response.status_code == 404:
                raise NotFoundError(f"Resource not found: {path}")
            elif response.status_code == 422:
                err = response.json() if response.text else {}
                raise ValidationError(
                    err.get("message", "Validation failed"),
                    errors=err.get("errors", []),
                )
            elif response.status_code == 429:
                retry_after = int(response.headers.get("Retry-After", 60))
                raise RateLimitError(retry_after=retry_after)
            elif response.status_code >= 400:
                err = response.json() if response.text else {}
                raise SOVRError(
                    err.get("message", f"API error: {response.status_code}"),
                    status_code=response.status_code,
                    error_code=err.get("error"),
                )

            return response.json() if response.text else {}

        except requests.exceptions.Timeout:
            raise SOVRError(f"Request timeout after {self.timeout}s", error_code="TIMEOUT")
        except requests.exceptions.ConnectionError:
            raise SOVRError("Connection error", error_code="CONNECTION_ERROR")

    # ====================================================================
    # Core Endpoints
    # ====================================================================

    def gate_check(
        self,
        action: str,
        resource: str,
        context: Optional[Dict[str, Any]] = None,
        actor_id: Optional[str] = None,
        trace_id: Optional[str] = None,
    ) -> GateCheckResult:
        """
        Evaluate whether an action should be allowed, denied, or escalated.

        This is the primary entry point for the SOVR execution firewall.

        Args:
            action: The action being attempted (e.g. "send_payment")
            resource: The resource being acted upon (e.g. "stripe/charge")
            context: Additional context for policy evaluation
            actor_id: ID of the actor performing the action
            trace_id: Distributed trace ID for correlation

        Returns:
            GateCheckResult with allowed, requires_approval, risk_score, etc.
        """
        data: Dict[str, Any] = {"action": action, "resource": resource}
        if context:
            data["context"] = context
        if actor_id:
            data["actor_id"] = actor_id
        if trace_id:
            data["trace_id"] = trace_id

        resp = self._request("POST", "/gate-check", data=data)
        return GateCheckResult.from_dict(resp)

    def request_approval(
        self,
        decision_id: str,
        justification: str,
        urgency: str = "medium",
        notify_channels: Optional[List[str]] = None,
    ) -> ApprovalResult:
        """
        Request human approval for a high-risk action.

        Call this when gate_check returns requires_approval=True.
        """
        data: Dict[str, Any] = {
            "decision_id": decision_id,
            "justification": justification,
            "urgency": urgency,
        }
        if notify_channels:
            data["notify_channels"] = notify_channels
        resp = self._request("POST", "/request-approval", data=data)
        return ApprovalResult.from_dict(resp)

    def grant_permit(
        self,
        decision_id: str,
        ttl_seconds: Optional[int] = None,
    ) -> PermitResult:
        """
        Issue a cryptographically signed execution permit.
        """
        data: Dict[str, Any] = {"decision_id": decision_id}
        if ttl_seconds is not None:
            data["ttl_seconds"] = ttl_seconds
        resp = self._request("POST", "/grant-permit", data=data)
        return PermitResult.from_dict(resp)

    def submit_receipt(
        self,
        decision_id: str,
        permit_id: str,
        external_ref: str,
        status: str,
        started_at: int,
        finished_at: int,
        output_hash: str,
        artifact_refs: Optional[List[str]] = None,
        idempotency_key: Optional[str] = None,
        error_code: Optional[str] = None,
        error_message: Optional[str] = None,
    ) -> ReceiptResult:
        """
        Submit an execution receipt to complete the audit trail.
        """
        data: Dict[str, Any] = {
            "decision_id": decision_id,
            "permit_id": permit_id,
            "external_ref": external_ref,
            "status": status,
            "started_at": started_at,
            "finished_at": finished_at,
            "output_hash": output_hash,
            "artifact_refs": artifact_refs or [],
            "idempotency_key": idempotency_key or f"{decision_id}-{int(time.time() * 1000)}",
        }
        if error_code:
            data["error_code"] = error_code
        if error_message:
            data["error_message"] = error_message
        resp = self._request("POST", "/submit-receipt", data=data)
        return ReceiptResult.from_dict(resp)

    # ====================================================================
    # Advanced Endpoints
    # ====================================================================

    def replay_decision(
        self,
        decision_id: str,
        policy_version: Optional[str] = None,
        target_time: Optional[int] = None,
        include_diff: bool = False,
    ) -> ReplayResult:
        """Replay a historical decision against current or specified policy."""
        data: Dict[str, Any] = {"decision_id": decision_id, "include_diff": include_diff}
        if policy_version:
            data["policy_version"] = policy_version
        if target_time is not None:
            data["target_time"] = target_time
        resp = self._request("POST", "/replay-decision", data=data)
        return ReplayResult.from_dict(resp)

    def export_bundle(
        self,
        decision_id: str,
        format: str = "json",
        include_merkle_proof: bool = True,
        include_signatures: bool = True,
    ) -> ExportBundleResult:
        """Export a Trust Bundle for a decision."""
        data = {
            "decision_id": decision_id,
            "format": format,
            "include_merkle_proof": include_merkle_proof,
            "include_signatures": include_signatures,
        }
        resp = self._request("POST", "/export-bundle", data=data)
        return ExportBundleResult.from_dict(resp)

    # ====================================================================
    # Operational Endpoints
    # ====================================================================

    def get_status(self) -> StatusResult:
        """Get API status and public key."""
        if self.mode == "cloud":
            resp = self._request("GET", "/status")
        else:
            url = f"{self.endpoint}/api/mcp/status-v2"
            response = self.session.get(
                url,
                headers={"User-Agent": f"sovr-sdk-python/{SDK_VERSION}"},
                timeout=self.timeout,
            )
            resp = response.json() if response.text else {}
        return StatusResult.from_dict(resp)

    def health_check(self) -> Dict[str, Any]:
        """Health check."""
        if self.mode == "cloud":
            return self._request("GET", "/status")
        url = f"{self.endpoint}/api/mcp/health"
        response = self.session.get(
            url,
            headers={"User-Agent": f"sovr-sdk-python/{SDK_VERSION}"},
            timeout=self.timeout,
        )
        return response.json() if response.text else {}

    # ====================================================================
    # OpenGuard — Content Security Scanning
    # ====================================================================

    def scan_content(
        self,
        content: str,
        content_type: Optional[str] = None,
        language: Optional[str] = None,
        enable_fact_anchor: bool = False,
        enable_github: bool = False,
        cross_ref_confidence_threshold: Optional[float] = None,
        cross_ref_engine: Optional[str] = None,
    ) -> ScanResult:
        """
        Scan content for security issues, hallucinations, and policy violations.

        Performs multi-layer analysis:
        - Layer 1: Pattern matching (secrets, PII, injection)
        - Layer 2: Structural analysis (code quality, dependency risks)
        - Layer 3: Fact anchor verification (optional, via Perplexity/Grok)

        Args:
            content: Content to scan (code, text, markdown, etc.)
            content_type: 'code', 'text', 'markdown', or 'html'
            language: Programming language (for code content)
            enable_fact_anchor: Enable fact anchor verification
            enable_github: Enable GitHub repository verification
            cross_ref_confidence_threshold: Confidence threshold (0-1)
            cross_ref_engine: 'perplexity', 'grok', or 'dual'

        Returns:
            ScanResult with safe flag, risk_score, findings, and fact_anchor data

        Example:
            >>> result = sovr.scan_content(
            ...     content=ai_generated_code,
            ...     content_type="code",
            ...     language="python",
            ...     enable_fact_anchor=True,
            ...     cross_ref_engine="dual",
            ... )
            >>> if not result.safe:
            ...     print(f"Found {len(result.findings)} issues")
        """
        data: Dict[str, Any] = {"content": content}
        if content_type:
            data["content_type"] = content_type
        if language:
            data["language"] = language
        if enable_fact_anchor:
            data["enable_fact_anchor"] = True
        if enable_github:
            data["enable_github"] = True
        if cross_ref_confidence_threshold is not None:
            data["cross_ref_confidence_threshold"] = cross_ref_confidence_threshold
        if cross_ref_engine:
            data["cross_ref_engine"] = cross_ref_engine
        resp = self._request("POST", "/openguard-scan", data=data)
        return ScanResult.from_dict(resp)

    def quick_scan(
        self,
        content: str,
        content_type: Optional[str] = None,
        language: Optional[str] = None,
    ) -> QuickScanResult:
        """
        Quick scan — lightweight pattern-only check without fact verification.

        Args:
            content: Content to scan
            content_type: Content type hint
            language: Programming language

        Returns:
            QuickScanResult with summary counts
        """
        data: Dict[str, Any] = {"content": content}
        if content_type:
            data["content_type"] = content_type
        if language:
            data["language"] = language
        resp = self._request("POST", "/openguard-quick-scan", data=data)
        return QuickScanResult.from_dict(resp)

    def get_scan_stats(self) -> ScanStats:
        """Get OpenGuard scanning statistics."""
        resp = self._request("GET", "/openguard-stats")
        return ScanStats.from_dict(resp)

    # ====================================================================
    # KillSwitch — Emergency Degradation Control
    # ====================================================================

    def get_killswitch_status(self) -> KillSwitchStatus:
        """
        Get the current KillSwitch status and degradation level.

        Returns:
            KillSwitchStatus with active flag, level, and reason

        Example:
            >>> status = sovr.get_killswitch_status()
            >>> if status.active:
            ...     print(f"System degraded to level {status.level}: {status.reason}")
        """
        resp = self._request("GET", "/killswitch/status")
        return KillSwitchStatus.from_dict(resp)

    def trigger_killswitch(
        self,
        reason: str,
        level: int = 5,
        actor_id: Optional[str] = None,
    ) -> KillSwitchTriggerResult:
        """
        Trigger the KillSwitch to degrade or shut down the system.

        This is an irreversible-class action. Requires admin scope.

        Args:
            reason: Reason for triggering
            level: Target degradation level (1-5, default: 5)
            actor_id: Actor ID

        Returns:
            KillSwitchTriggerResult
        """
        data: Dict[str, Any] = {"reason": reason, "level": level}
        if actor_id:
            data["actor_id"] = actor_id
        resp = self._request("POST", "/killswitch/trigger", data=data)
        return KillSwitchTriggerResult.from_dict(resp)

    def recover_killswitch(
        self,
        reason: str,
        actor_id: Optional[str] = None,
    ) -> KillSwitchRecoverResult:
        """
        Recover from a KillSwitch activation.

        Requires admin scope and human approval.

        Args:
            reason: Reason for recovery
            actor_id: Actor ID

        Returns:
            KillSwitchRecoverResult
        """
        data: Dict[str, Any] = {"reason": reason}
        if actor_id:
            data["actor_id"] = actor_id
        resp = self._request("POST", "/killswitch/recover", data=data)
        return KillSwitchRecoverResult.from_dict(resp)

    # ====================================================================
    # Policy — Policy Management
    # ====================================================================

    def validate_policy(
        self,
        policy_set: Dict[str, Any],
    ) -> PolicyValidateResult:
        """
        Validate a policy set without deploying it.

        Args:
            policy_set: Policy set dict with id, name, version, rules, default_action

        Returns:
            PolicyValidateResult with valid flag and errors

        Example:
            >>> result = sovr.validate_policy({
            ...     "id": "prod-v2",
            ...     "name": "Production Policy",
            ...     "version": "2.0.0",
            ...     "rules": [...],
            ...     "default_action": "deny",
            ... })
            >>> if not result.valid:
            ...     print("Errors:", result.errors)
        """
        resp = self._request("POST", "/policy/validate", data={"policy_set": policy_set})
        return PolicyValidateResult.from_dict(resp)

    def get_policy_version(self) -> PolicyVersionResult:
        """Get the current active policy version."""
        resp = self._request("GET", "/policy/version")
        return PolicyVersionResult.from_dict(resp)

    # ====================================================================
    # Budget — Resource Consumption & Quota Management
    # ====================================================================

    def get_budget_status(self) -> BudgetStatusResult:
        """
        Get current budget status across all budget types.

        Returns:
            BudgetStatusResult with budgets list and overall_decision

        Example:
            >>> status = sovr.get_budget_status()
            >>> print(status.overall_decision)  # 'OK' | 'WARN' | 'TIGHTEN' | 'BLOCK'
            >>> for b in status.budgets:
            ...     print(f"{b.type}: {b.utilization}%")
        """
        resp = self._request("GET", "/budget/status")
        return BudgetStatusResult.from_dict(resp)

    def consume_budget(
        self,
        budget_type: str,
        amount: float,
        reason: str,
    ) -> BudgetConsumeResult:
        """
        Consume budget for a specific resource type.

        Args:
            budget_type: Budget type ('human', 'error', 'model', 'cost')
            amount: Amount to consume
            reason: Reason for consumption

        Returns:
            BudgetConsumeResult with remaining balance and decision
        """
        data = {"budget_type": budget_type, "amount": amount, "reason": reason}
        resp = self._request("POST", "/budget/consume", data=data)
        return BudgetConsumeResult.from_dict(resp)

    def get_budget_history(
        self,
        budget_type: Optional[str] = None,
        limit: int = 50,
        offset: int = 0,
    ) -> BudgetHistoryResult:
        """
        Get budget consumption history (ledger entries).

        Args:
            budget_type: Filter by budget type (optional)
            limit: Max entries to return
            offset: Pagination offset
        """
        params: Dict[str, Any] = {"limit": limit, "offset": offset}
        if budget_type:
            params["budget_type"] = budget_type
        resp = self._request("GET", "/budget/history", params=params)
        return BudgetHistoryResult.from_dict(resp)

    def set_budget_limit(
        self,
        budget_type: str,
        limit: float,
        window_hours: int = 24,
    ) -> BudgetSetLimitResult:
        """
        Set or update budget limits. Requires admin scope.

        Args:
            budget_type: Budget type to configure
            limit: New limit value
            window_hours: Time window in hours (default: 24)
        """
        data = {"budget_type": budget_type, "limit": limit, "window_hours": window_hours}
        resp = self._request("POST", "/budget/set-limit", data=data)
        return BudgetSetLimitResult.from_dict(resp)

    def get_budget_alerts(self) -> BudgetAlertResult:
        """Get active budget alerts (budgets approaching thresholds)."""
        resp = self._request("GET", "/budget/alerts")
        return BudgetAlertResult.from_dict(resp)

    # ====================================================================
    # Audit — Immutable Audit Chain & Evidence
    # ====================================================================

    def get_audit_trail(
        self,
        trace_id: Optional[str] = None,
        start_date: Optional[str] = None,
        end_date: Optional[str] = None,
        limit: int = 50,
        offset: int = 0,
    ) -> AuditTrailResult:
        """
        Query the audit trail with optional filters.

        Args:
            trace_id: Filter by trace ID
            start_date: Start date (ISO format)
            end_date: End date (ISO format)
            limit: Max records to return
            offset: Pagination offset

        Returns:
            AuditTrailResult with records, total count, and chain validity
        """
        params: Dict[str, Any] = {"limit": limit, "offset": offset}
        if trace_id:
            params["trace_id"] = trace_id
        if start_date:
            params["start_date"] = start_date
        if end_date:
            params["end_date"] = end_date
        resp = self._request("GET", "/audit/trail", params=params)
        return AuditTrailResult.from_dict(resp)

    def verify_audit_chain(
        self,
        start_date: Optional[str] = None,
        end_date: Optional[str] = None,
    ) -> AuditChainVerifyResult:
        """
        Verify the integrity of the audit chain.

        Checks hash-chain continuity and detects tampered records.

        Returns:
            AuditChainVerifyResult with validity and broken link count
        """
        params: Dict[str, Any] = {}
        if start_date:
            params["start_date"] = start_date
        if end_date:
            params["end_date"] = end_date
        resp = self._request("GET", "/audit/verify", params=params)
        return AuditChainVerifyResult.from_dict(resp)

    def get_audit_stats(self) -> AuditStatsResult:
        """Get aggregate audit statistics."""
        resp = self._request("GET", "/audit/stats")
        return AuditStatsResult.from_dict(resp)

    def export_audit_report(
        self,
        format: str = "json",
        start_date: Optional[str] = None,
        end_date: Optional[str] = None,
    ) -> AuditExportResult:
        """
        Export audit records as a downloadable report.

        Args:
            format: Export format ('json' or 'csv')
            start_date: Start date filter
            end_date: End date filter

        Returns:
            AuditExportResult with download URL
        """
        data: Dict[str, Any] = {"format": format}
        if start_date:
            data["start_date"] = start_date
        if end_date:
            data["end_date"] = end_date
        resp = self._request("POST", "/audit/export", data=data)
        return AuditExportResult.from_dict(resp)

    # ====================================================================
    # Monitoring — System Health, Metrics & Alerts
    # ====================================================================

    def get_system_health(self) -> SystemHealthResult:
        """
        Get comprehensive system health status.

        Returns:
            SystemHealthResult with component statuses and uptime

        Example:
            >>> health = sovr.get_system_health()
            >>> print(f"System: {health.status}, uptime: {health.uptime_seconds}s")
        """
        resp = self._request("GET", "/monitoring/health")
        return SystemHealthResult.from_dict(resp)

    def get_metrics(
        self,
        name: str,
        start_time: Optional[str] = None,
        end_time: Optional[str] = None,
        limit: int = 100,
    ) -> MetricsResult:
        """
        Query metric time-series data.

        Args:
            name: Metric name (e.g. 'gate_check_latency_ms')
            start_time: Start time (ISO format)
            end_time: End time (ISO format)
            limit: Max data points
        """
        params: Dict[str, Any] = {"name": name, "limit": limit}
        if start_time:
            params["start_time"] = start_time
        if end_time:
            params["end_time"] = end_time
        resp = self._request("GET", "/monitoring/metrics", params=params)
        return MetricsResult.from_dict(resp)

    def get_alerts(self) -> AlertsResult:
        """Get active monitoring alerts."""
        resp = self._request("GET", "/monitoring/alerts")
        return AlertsResult.from_dict(resp)

    def acknowledge_alert(
        self,
        alert_id: str,
        note: Optional[str] = None,
    ) -> AlertAckResult:
        """
        Acknowledge a monitoring alert.

        Args:
            alert_id: Alert ID to acknowledge
            note: Optional note for the acknowledgment
        """
        data: Dict[str, Any] = {"alert_id": alert_id}
        if note:
            data["note"] = note
        resp = self._request("POST", "/monitoring/alerts/ack", data=data)
        return AlertAckResult.from_dict(resp)

    # ====================================================================
    # P2: p1p2 Cognitive Security
    # ====================================================================

    def epistemic_check(self, claims: List[Dict[str, Any]], context: Optional[str] = None) -> EpistemicCheckResult:
        """Verify epistemic contract."""
        data: Dict[str, Any] = {"claims": claims}
        if context: data["context"] = context
        return EpistemicCheckResult.from_dict(self._request("POST", "/p1p2/epistemic/check", data=data))

    def submit_evidence(self, claim_id: str, evidence_type: str, content: str) -> SubmitEvidenceResult:
        """Submit evidence for a claim."""
        return SubmitEvidenceResult.from_dict(self._request("POST", "/p1p2/epistemic/evidence", data={"claim_id": claim_id, "evidence_type": evidence_type, "content": content}))

    def detect_adversarial(self, content: str, context: Optional[str] = None) -> AdversarialDetectResult:
        """Detect adversarial attacks."""
        data: Dict[str, Any] = {"content": content}
        if context: data["context"] = context
        return AdversarialDetectResult.from_dict(self._request("POST", "/p1p2/adversarial/detect", data=data))

    def filter_narrative(self, content: str, rules: Optional[List[str]] = None) -> NarrativeFilterResult:
        """Filter content through narrative firewall."""
        data: Dict[str, Any] = {"content": content}
        if rules: data["rules"] = rules
        return NarrativeFilterResult.from_dict(self._request("POST", "/p1p2/narrative/filter", data=data))

    def list_narrative_rules(self) -> List[NarrativeRule]:
        """List narrative firewall rules."""
        resp = self._request("GET", "/p1p2/narrative/rules")
        return [NarrativeRule.from_dict(r) for r in resp.get("rules", [])]

    def check_reality(self, assertions: List[Dict[str, Any]]) -> RealityCheckResult:
        """Check reality anchoring."""
        return RealityCheckResult.from_dict(self._request("POST", "/p1p2/reality/check", data={"assertions": assertions}))

    def get_sla_metrics(self) -> SLAMetricsResult:
        """Get SLA metrics."""
        return SLAMetricsResult.from_dict(self._request("GET", "/p1p2/reality/sla"))

    def get_context_bundle(self, bundle_id: str) -> ContextBundle:
        """Get a context bundle."""
        return ContextBundle.from_dict(self._request("GET", f"/p1p2/context/bundle/{bundle_id}"))

    def create_context_bundle(self, data_payload: Dict[str, Any], ttl: int = 3600) -> ContextBundle:
        """Create a context bundle."""
        return ContextBundle.from_dict(self._request("POST", "/p1p2/context/bundle", data={"data": data_payload, "ttl": ttl}))

    def write_memory(self, namespace: str, key: str, value: Any, ttl: Optional[int] = None) -> MemoryWriteResult:
        """Write to memory chain."""
        data: Dict[str, Any] = {"namespace": namespace, "key": key, "value": value}
        if ttl: data["ttl"] = ttl
        return MemoryWriteResult.from_dict(self._request("POST", "/p1p2/memory/write", data=data))

    def search_memory(self, namespace: str, query: str, limit: int = 10) -> MemorySearchResult:
        """Search memory chain."""
        return MemorySearchResult.from_dict(self._request("POST", "/p1p2/memory/search", data={"namespace": namespace, "query": query, "limit": limit}))

    def check_precedent(self, action: str, resource: str, context: Optional[Dict[str, Any]] = None) -> PrecedentCheckResult:
        """Check for precedent decisions."""
        data: Dict[str, Any] = {"action": action, "resource": resource}
        if context: data["context"] = context
        return PrecedentCheckResult.from_dict(self._request("POST", "/p1p2/precedent/check", data=data))

    def record_cost_event(self, cost_type: str, amount: float, metadata: Optional[Dict[str, Any]] = None) -> CostEventResult:
        """Record a cost event."""
        data: Dict[str, Any] = {"cost_type": cost_type, "amount": amount}
        if metadata: data["metadata"] = metadata
        return CostEventResult.from_dict(self._request("POST", "/p1p2/cost/record", data=data))

    def log_canary_decision(self, decision_id: str, input_data: Dict[str, Any], output_data: Dict[str, Any]) -> CanaryLogResult:
        """Log a canary decision."""
        return CanaryLogResult.from_dict(self._request("POST", "/p1p2/canary/log", data={"decision_id": decision_id, "input": input_data, "output": output_data}))

    def replay_canary_decision(self, decision_id: str) -> CanaryReplayResult:
        """Replay a canary decision."""
        return CanaryReplayResult.from_dict(self._request("POST", f"/p1p2/canary/replay/{decision_id}"))

    def list_degradations(self) -> DegradationListResult:
        """List degradation entries."""
        return DegradationListResult.from_dict(self._request("GET", "/p1p2/degrade/list"))

    def create_degradation(self, name: str, level: str, reason: str) -> DegradationEntry:
        """Create a degradation entry."""
        return DegradationEntry.from_dict(self._request("POST", "/p1p2/degrade/create", data={"name": name, "level": level, "reason": reason}))

    def resolve_degradation(self, degradation_id: str) -> DegradationEntry:
        """Resolve a degradation entry."""
        return DegradationEntry.from_dict(self._request("POST", f"/p1p2/degrade/resolve/{degradation_id}"))

    def evaluate_meta_supervision(self) -> MetaSupervisionResult:
        """Evaluate meta supervision."""
        return MetaSupervisionResult.from_dict(self._request("GET", "/p1p2/meta-supervision/evaluate"))

    def get_failure_budget(self) -> FailureBudgetResult:
        """Get failure budget."""
        return FailureBudgetResult.from_dict(self._request("GET", "/p1p2/failure/budget"))

    def run_llm_evaluation(self, options: Optional[Dict[str, Any]] = None) -> LLMEvaluationResult:
        """Run LLM evaluation."""
        return LLMEvaluationResult.from_dict(self._request("POST", "/p1p2/llm-evaluator/run", data=options or {}))

    def analyze_reasoning(self, content: str, context: Optional[str] = None) -> ReasoningAnalysisResult:
        """Analyze reasoning quality."""
        data: Dict[str, Any] = {"content": content}
        if context: data["context"] = context
        return ReasoningAnalysisResult.from_dict(self._request("POST", "/p1p2/llm-evaluator/reasoning", data=data))

    # ====================================================================
    # P2: p3Fusion Compliance & Governance
    # ====================================================================

    def list_data_assets(self) -> List[DataAsset]:
        """List data governance assets."""
        resp = self._request("GET", "/p3/data-governance/assets")
        return [DataAsset.from_dict(a) for a in resp.get("assets", [])]

    def classify_data(self, content: str, data_type: Optional[str] = None) -> DataClassifyResult:
        """Classify data."""
        data: Dict[str, Any] = {"content": content}
        if data_type: data["data_type"] = data_type
        return DataClassifyResult.from_dict(self._request("POST", "/p3/data-governance/classify", data=data))

    def trace_lineage(self, asset_id: str) -> DataLineageResult:
        """Trace data lineage."""
        return DataLineageResult.from_dict(self._request("GET", f"/p3/data-governance/lineage/{asset_id}"))

    def check_data_quality(self, options: Optional[Dict[str, Any]] = None) -> DataQualityResult:
        """Check data quality."""
        return DataQualityResult.from_dict(self._request("POST", "/p3/data-governance/quality", data=options or {}))

    def detect_pii(self, content: str, categories: Optional[List[str]] = None) -> PIIDetectResult:
        """Detect PII in content."""
        data: Dict[str, Any] = {"content": content}
        if categories: data["categories"] = categories
        return PIIDetectResult.from_dict(self._request("POST", "/p3/privacy/detect-pii", data=data))

    def mask_data(self, content: str, rules: Optional[List[str]] = None) -> MaskDataResult:
        """Mask sensitive data."""
        data: Dict[str, Any] = {"content": content}
        if rules: data["rules"] = rules
        return MaskDataResult.from_dict(self._request("POST", "/p3/privacy/mask", data=data))

    def check_consent(self, user_id: str, purpose: str) -> ConsentCheckResult:
        """Check user consent."""
        return ConsentCheckResult.from_dict(self._request("POST", "/p3/privacy/consent/check", data={"user_id": user_id, "purpose": purpose}))

    def list_pias(self) -> List[PIAEntry]:
        """List Privacy Impact Assessments."""
        resp = self._request("GET", "/p3/privacy/pias")
        return [PIAEntry.from_dict(p) for p in resp.get("pias", [])]

    def run_compliance_check(self, framework: str, scope: Optional[str] = None) -> ComplianceCheckResult:
        """Run compliance check."""
        data: Dict[str, Any] = {"framework": framework}
        if scope: data["scope"] = scope
        return ComplianceCheckResult.from_dict(self._request("POST", "/p3/compliance/check", data=data))

    def generate_compliance_report(self, framework: str, options: Optional[Dict[str, Any]] = None) -> ComplianceReportResult:
        """Generate compliance report."""
        data: Dict[str, Any] = {"framework": framework, **(options or {})}
        return ComplianceReportResult.from_dict(self._request("POST", "/p3/compliance/report", data=data))

    def analyze_gaps(self, framework: str, current_controls: Optional[List[str]] = None) -> GapAnalysisResult:
        """Analyze compliance gaps."""
        data: Dict[str, Any] = {"framework": framework}
        if current_controls: data["current_controls"] = current_controls
        return GapAnalysisResult.from_dict(self._request("POST", "/p3/compliance/gaps", data=data))

    def check_quota(self, tenant_id: str, resource: str) -> QuotaCheckResult:
        """Check SaaS quota."""
        return QuotaCheckResult.from_dict(self._request("POST", "/p3/saas/quota/check", data={"tenant_id": tenant_id, "resource": resource}))

    def validate_access(self, tenant_id: str, resource: str, action: str) -> AccessValidateResult:
        """Validate SaaS access."""
        return AccessValidateResult.from_dict(self._request("POST", "/p3/saas/access/validate", data={"tenant_id": tenant_id, "resource": resource, "action": action}))

    def get_subscription_stats(self) -> SubscriptionStatsResult:
        """Get subscription statistics."""
        return SubscriptionStatsResult.from_dict(self._request("GET", "/p3/saas/subscription/stats"))

    def calculate_trust_score(self, entity_id: str, entity_type: str = "user") -> TrustScoreResult:
        """Calculate trust score."""
        return TrustScoreResult.from_dict(self._request("POST", "/p3/scoring/calculate", data={"entity_id": entity_id, "entity_type": entity_type}))

    def get_trust_score_history(self, entity_id: str, limit: int = 50) -> TrustScoreHistoryResult:
        """Get trust score history."""
        return TrustScoreHistoryResult.from_dict(self._request("POST", "/p3/scoring/history", data={"entity_id": entity_id, "limit": limit}))

    def batch_calculate_scores(self, entity_ids: List[str], entity_type: str = "user") -> BatchScoreResult:
        """Batch calculate trust scores."""
        return BatchScoreResult.from_dict(self._request("POST", "/p3/scoring/batch", data={"entity_ids": entity_ids, "entity_type": entity_type}))

    def assess_risk(self, options: Optional[Dict[str, Any]] = None) -> RiskAssessResult:
        """Assess risk."""
        return RiskAssessResult.from_dict(self._request("POST", "/p3/risk/assess", data=options or {}))

    def detect_risks(self) -> RiskDetectResult:
        """Detect risks."""
        return RiskDetectResult.from_dict(self._request("GET", "/p3/risk/detect"))

    def report_incident(self, title: str, severity: str, description: str) -> IncidentReportResult:
        """Report an incident."""
        return IncidentReportResult.from_dict(self._request("POST", "/p3/risk/incident", data={"title": title, "severity": severity, "description": description}))

    def list_incidents(self) -> List[IncidentEntry]:
        """List incidents."""
        resp = self._request("GET", "/p3/risk/incidents")
        return [IncidentEntry.from_dict(i) for i in resp.get("incidents", [])]

    def list_policies(self) -> List[PolicyEntry]:
        """List policies."""
        resp = self._request("GET", "/p3/policy-engine/list")
        return [PolicyEntry.from_dict(p) for p in resp.get("policies", [])]

    def create_policy(self, name: str, rules: List[Dict[str, Any]], version: Optional[str] = None) -> CreatePolicyResult:
        """Create a policy."""
        data: Dict[str, Any] = {"name": name, "rules": rules}
        if version: data["version"] = version
        return CreatePolicyResult.from_dict(self._request("POST", "/p3/policy-engine/create", data=data))

    def evaluate_policy(self, action: str, resource: str, context: Optional[Dict[str, Any]] = None) -> EvaluatePolicyResult:
        """Evaluate policy."""
        data: Dict[str, Any] = {"action": action, "resource": resource}
        if context: data["context"] = context
        return EvaluatePolicyResult.from_dict(self._request("POST", "/p3/policy-engine/evaluate", data=data))

    def detect_conflicts(self) -> ConflictDetectResult:
        """Detect policy conflicts."""
        return ConflictDetectResult.from_dict(self._request("GET", "/p3/policy-engine/conflicts"))

    def list_integration_rules(self) -> List[IntegrationRule]:
        """List integration rules."""
        resp = self._request("GET", "/p3/integration/rules")
        return [IntegrationRule.from_dict(r) for r in resp.get("rules", [])]

    def create_integration_rule(self, name: str, event_type: str, action: str) -> CreateIntegrationRuleResult:
        """Create an integration rule."""
        return CreateIntegrationRuleResult.from_dict(self._request("POST", "/p3/integration/rules", data={"name": name, "event_type": event_type, "action": action}))

    def publish_event(self, event_type: str, payload: Dict[str, Any]) -> PublishEventResult:
        """Publish an integration event."""
        return PublishEventResult.from_dict(self._request("POST", "/p3/integration/events", data={"event_type": event_type, "payload": payload}))

    # ====================================================================
    # P3: ModelOps
    # ====================================================================

    def list_models(self) -> List[ModelInfo]:
        """List all registered models."""
        resp = self._request("GET", "/p3/model-ops/models")
        return [ModelInfo.from_dict(m) for m in resp.get("models", [])]

    def select_model(self, action: Optional[str] = None, tenant_id: Optional[str] = None, task_type: Optional[str] = None) -> ModelSelectResult:
        """Select optimal model for a task."""
        data: Dict[str, Any] = {}
        if action: data["action"] = action
        if tenant_id: data["tenant_id"] = tenant_id
        if task_type: data["task_type"] = task_type
        return ModelSelectResult.from_dict(self._request("POST", "/p3/model-ops/select", data=data))

    def get_circuit_breaker_events(self, model_id: Optional[str] = None, limit: Optional[int] = None) -> List[CircuitBreakerEvent]:
        """Get circuit breaker events."""
        params: Dict[str, str] = {}
        if model_id: params["modelId"] = model_id
        if limit: params["limit"] = str(limit)
        resp = self._request("GET", "/p3/model-ops/circuit-breaker", params=params)
        return [CircuitBreakerEvent.from_dict(e) for e in resp.get("events", [])]

    def list_active_ab_tests(self, task_type: Optional[str] = None) -> List[ABTestInfo]:
        """List active A/B tests."""
        params: Dict[str, str] = {}
        if task_type: params["taskType"] = task_type
        resp = self._request("GET", "/p3/model-ops/ab-tests", params=params)
        return [ABTestInfo.from_dict(t) for t in resp.get("tests", [])]

    def get_prompt_template(self, name: str, version: Optional[str] = None) -> PromptTemplateInfo:
        """Get a prompt template by name."""
        params: Dict[str, str] = {}
        if version: params["version"] = version
        return PromptTemplateInfo.from_dict(self._request("GET", f"/p3/model-ops/prompt-templates/{name}", params=params))

    def render_prompt(self, template_id: str, variables: Dict[str, str]) -> PromptRenderResult:
        """Render a prompt template with variables."""
        return PromptRenderResult.from_dict(self._request("POST", "/p3/model-ops/render-prompt", data={"template_id": template_id, "variables": variables}))

    def get_routing_decision_log(self, limit: Optional[int] = None) -> List[RoutingDecisionInfo]:
        """Get routing decision log."""
        params: Dict[str, str] = {}
        if limit: params["limit"] = str(limit)
        resp = self._request("GET", "/p3/model-ops/routing-log", params=params)
        return [RoutingDecisionInfo.from_dict(d) for d in resp.get("decisions", [])]

    def get_model_usage_stats(self, model_id: Optional[str] = None, hours: Optional[int] = None) -> List[ModelUsageStatsInfo]:
        """Get model usage statistics."""
        params: Dict[str, str] = {}
        if model_id: params["modelId"] = model_id
        if hours: params["hours"] = str(hours)
        resp = self._request("GET", "/p3/model-ops/usage-stats", params=params)
        return [ModelUsageStatsInfo.from_dict(s) for s in resp.get("stats", [])]

    def get_all_model_health_status(self) -> List[ModelHealthStatusInfo]:
        """Get health status of all models."""
        resp = self._request("GET", "/p3/model-ops/health")
        return [ModelHealthStatusInfo.from_dict(m) for m in resp.get("models", [])]

    def list_prompt_templates(self) -> List[PromptTemplateInfo]:
        """List all prompt templates."""
        resp = self._request("GET", "/p3/model-ops/prompt-templates")
        return [PromptTemplateInfo.from_dict(t) for t in resp.get("templates", [])]

    def create_prompt_template(self, prompt_name: str, version: str, template_text: str, **kwargs) -> PromptTemplateInfo:
        """Create a new prompt template."""
        data = {"prompt_name": prompt_name, "version": version, "template_text": template_text, **kwargs}
        return PromptTemplateInfo.from_dict(self._request("POST", "/p3/model-ops/prompt-templates", data=data))

    def update_prompt_template(self, id: str, **kwargs) -> PromptTemplateInfo:
        """Update an existing prompt template."""
        data = {"id": id, **kwargs}
        return PromptTemplateInfo.from_dict(self._request("PUT", "/p3/model-ops/prompt-templates", data=data))

    def deactivate_prompt_template(self, id: str) -> Dict[str, Any]:
        """Deactivate a prompt template."""
        return self._request("POST", f"/p3/model-ops/prompt-templates/{id}/deactivate")

    # ====================================================================
    # P3: TaskQueue
    # ====================================================================

    def create_task(self, type: str, payload: Dict[str, Any], priority: Optional[int] = None, max_retries: Optional[int] = None, tenant_id: Optional[str] = None) -> TaskInfo:
        """Create a new task in the queue."""
        data: Dict[str, Any] = {"type": type, "payload": payload}
        if priority is not None: data["priority"] = priority
        if max_retries is not None: data["max_retries"] = max_retries
        if tenant_id: data["tenant_id"] = tenant_id
        return TaskInfo.from_dict(self._request("POST", "/p3/task-queue/create", data=data))

    def list_tasks_by_status(self, status: Optional[str] = None, limit: Optional[int] = None) -> List[TaskInfo]:
        """List tasks by status."""
        params: Dict[str, str] = {}
        if status: params["status"] = status
        if limit: params["limit"] = str(limit)
        resp = self._request("GET", "/p3/task-queue/list", params=params)
        return [TaskInfo.from_dict(t) for t in resp.get("tasks", [])]

    def get_task_queue_stats(self) -> TaskQueueStatsInfo:
        """Get task queue statistics."""
        return TaskQueueStatsInfo.from_dict(self._request("GET", "/p3/task-queue/stats"))

    def get_dead_letter_queue(self, limit: Optional[int] = None) -> List[TaskInfo]:
        """Get dead letter queue tasks."""
        params: Dict[str, str] = {}
        if limit: params["limit"] = str(limit)
        resp = self._request("GET", "/p3/task-queue/dead-letter", params=params)
        return [TaskInfo.from_dict(t) for t in resp.get("tasks", [])]

    def get_task_by_id(self, task_id: str) -> TaskInfo:
        """Get a task by its ID."""
        return TaskInfo.from_dict(self._request("GET", f"/p3/task-queue/{task_id}"))

    def complete_task(self, task_id: str, result: Dict[str, Any]) -> TaskInfo:
        """Mark a task as completed."""
        return TaskInfo.from_dict(self._request("POST", "/p3/task-queue/complete", data={"task_id": task_id, "result": result}))

    def fail_task(self, task_id: str, error_message: str) -> TaskInfo:
        """Mark a task as failed."""
        return TaskInfo.from_dict(self._request("POST", "/p3/task-queue/fail", data={"task_id": task_id, "error_message": error_message}))

    def cancel_task(self, task_id: str, reason: Optional[str] = None) -> TaskInfo:
        """Cancel a task."""
        data: Dict[str, Any] = {"task_id": task_id}
        if reason: data["reason"] = reason
        return TaskInfo.from_dict(self._request("POST", "/p3/task-queue/cancel", data=data))

    # ====================================================================
    # P3: Experiment
    # ====================================================================

    def create_experiment(self, name: str, variants: List[Dict[str, Any]], description: Optional[str] = None) -> ExperimentInfo:
        """Create a new experiment."""
        data: Dict[str, Any] = {"name": name, "variants": variants}
        if description: data["description"] = description
        return ExperimentInfo.from_dict(self._request("POST", "/p3/experiments/create", data=data))

    def list_experiments(self) -> List[ExperimentInfo]:
        """List all experiments."""
        resp = self._request("GET", "/p3/experiments/list")
        return [ExperimentInfo.from_dict(e) for e in resp.get("experiments", [])]

    def start_experiment(self, experiment_id: str) -> Dict[str, Any]:
        """Start an experiment."""
        return self._request("POST", f"/p3/experiments/{experiment_id}/start")

    def stop_experiment(self, experiment_id: str, status: Optional[str] = None) -> Dict[str, Any]:
        """Stop an experiment."""
        data: Dict[str, Any] = {}
        if status: data["status"] = status
        return self._request("POST", f"/p3/experiments/{experiment_id}/stop", data=data if data else None)

    def assign_to_experiment(self, experiment_id: str) -> ExperimentAssignment:
        """Assign current user to an experiment."""
        return ExperimentAssignment.from_dict(self._request("POST", "/p3/experiments/assign", data={"experiment_id": experiment_id}))

    # ====================================================================
    # P3: AuditRegression
    # ====================================================================

    def create_regression_suite(self, suite_name: str, description: Optional[str] = None) -> RegressionSuite:
        """Create a regression test suite."""
        data: Dict[str, Any] = {"suite_name": suite_name}
        if description: data["description"] = description
        return RegressionSuite.from_dict(self._request("POST", "/p3/audit-regression/suites", data=data))

    def list_regression_suites(self) -> List[RegressionSuite]:
        """List all regression suites."""
        resp = self._request("GET", "/p3/audit-regression/suites")
        return [RegressionSuite.from_dict(s) for s in resp.get("suites", [])]

    def get_regression_suite(self, suite_id: str) -> RegressionSuite:
        """Get a regression suite by ID."""
        return RegressionSuite.from_dict(self._request("GET", f"/p3/audit-regression/suites/{suite_id}"))

    def run_regression_suite(self, suite_id: str, base_url: str) -> RegressionRun:
        """Run a regression test suite."""
        return RegressionRun.from_dict(self._request("POST", "/p3/audit-regression/run", data={"suite_id": suite_id, "base_url": base_url}))

    def get_regression_runs_by_suite(self, suite_id: str, limit: Optional[int] = None) -> List[RegressionRun]:
        """Get regression runs for a suite."""
        params: Dict[str, str] = {}
        if limit: params["limit"] = str(limit)
        resp = self._request("GET", f"/p3/audit-regression/suites/{suite_id}/runs", params=params)
        return [RegressionRun.from_dict(r) for r in resp.get("runs", [])]

    def get_latest_regression_runs(self, limit: Optional[int] = None) -> List[RegressionRun]:
        """Get latest regression runs."""
        params: Dict[str, str] = {}
        if limit: params["limit"] = str(limit)
        resp = self._request("GET", "/p3/audit-regression/runs/latest", params=params)
        return [RegressionRun.from_dict(r) for r in resp.get("runs", [])]

    # ====================================================================
    # P3: AuditReplay
    # ====================================================================

    def create_snapshot(self, snapshot_type: str, entity_type: str, entity_id: str, snapshot_data: Dict[str, Any], trigger_event: Optional[str] = None) -> SnapshotInfo:
        """Create an audit snapshot."""
        data: Dict[str, Any] = {"snapshot_type": snapshot_type, "entity_type": entity_type, "entity_id": entity_id, "snapshot_data": snapshot_data}
        if trigger_event: data["trigger_event"] = trigger_event
        return SnapshotInfo.from_dict(self._request("POST", "/p3/audit-replay/snapshots", data=data))

    def get_entity_snapshots(self, entity_type: str, entity_id: str, limit: Optional[int] = None) -> List[SnapshotInfo]:
        """Get snapshots for an entity."""
        params: Dict[str, str] = {}
        if limit: params["limit"] = str(limit)
        resp = self._request("GET", f"/p3/audit-replay/snapshots/{entity_type}/{entity_id}", params=params)
        return [SnapshotInfo.from_dict(s) for s in resp.get("snapshots", [])]

    def create_replay_session(self, session_name: str, session_type: str, replay_start_time: str, replay_end_time: str) -> ReplaySessionInfo:
        """Create a replay session."""
        return ReplaySessionInfo.from_dict(self._request("POST", "/p3/audit-replay/sessions", data={
            "session_name": session_name, "session_type": session_type,
            "replay_start_time": replay_start_time, "replay_end_time": replay_end_time
        }))

    def list_replay_sessions(self) -> List[ReplaySessionInfo]:
        """List all replay sessions."""
        resp = self._request("GET", "/p3/audit-replay/sessions")
        return [ReplaySessionInfo.from_dict(s) for s in resp.get("sessions", [])]

    def compare_snapshots(self, snapshot_id_a: str, snapshot_id_b: str) -> SnapshotCompareResult:
        """Compare two snapshots."""
        return SnapshotCompareResult.from_dict(self._request("POST", "/p3/audit-replay/compare", data={"snapshot_id_a": snapshot_id_a, "snapshot_id_b": snapshot_id_b}))

    # ====================================================================
    # P4: Gate Extended
    # ====================================================================

    def get_gate_config(self) -> GateConfigResult:
        """Get current gate configuration."""
        return GateConfigResult.from_dict(self._request("GET", "/gate/config"))

    def update_gate_config(self, config: Dict[str, Any]) -> GateConfigResult:
        """Update gate configuration."""
        return GateConfigResult.from_dict(self._request("POST", "/gate/config", data=config))

    def list_high_risk_actions(self) -> List[HighRiskActionInfo]:
        """List high risk actions."""
        resp = self._request("GET", "/gate/high-risk-actions")
        return [HighRiskActionInfo.from_dict(a) for a in resp.get("actions", [])]

    # ====================================================================
    # P4: Approval Extended
    # ====================================================================

    def list_pending_approvals(self) -> List[PendingApprovalInfo]:
        """List pending approvals."""
        resp = self._request("GET", "/approval/pending")
        return [PendingApprovalInfo.from_dict(a) for a in resp.get("approvals", [])]

    def approve_decision(self, decision_id: str, reason: Optional[str] = None) -> Dict[str, Any]:
        """Approve a pending decision."""
        return self._request("POST", "/approval/approve", data={"decision_id": decision_id, "reason": reason})

    def reject_decision(self, decision_id: str, reason: Optional[str] = None) -> Dict[str, Any]:
        """Reject a pending decision."""
        return self._request("POST", "/approval/reject", data={"decision_id": decision_id, "reason": reason})

    def get_approval_detail(self, approval_id: str) -> ApprovalDetailInfo:
        """Get approval detail."""
        return ApprovalDetailInfo.from_dict(self._request("GET", f"/approval/{approval_id}"))

    def get_approval_stats(self) -> ApprovalStatsInfo:
        """Get approval statistics."""
        return ApprovalStatsInfo.from_dict(self._request("GET", "/approval/stats"))

    # ====================================================================
    # P4: Audit Extended
    # ====================================================================

    def get_audit_chain(self, start_time: Optional[str] = None, end_time: Optional[str] = None) -> AuditChainResult:
        """Get audit chain."""
        params = {}
        if start_time: params["start_time"] = start_time
        if end_time: params["end_time"] = end_time
        return AuditChainResult.from_dict(self._request("GET", "/audit/chain", params=params))

    def get_audit_detail(self, audit_id: str) -> AuditDetailResult:
        """Get audit entry detail."""
        return AuditDetailResult.from_dict(self._request("GET", f"/audit/{audit_id}"))

    def verify_daily_root(self, date: str) -> DailyRootVerifyResult:
        """Verify daily root hash."""
        return DailyRootVerifyResult.from_dict(self._request("POST", "/audit/verify-daily-root", data={"date": date}))

    # ====================================================================
    # P4: Kill Switch Extended
    # ====================================================================

    def get_degradation_state(self) -> DegradationStateResult:
        """Get current degradation state."""
        return DegradationStateResult.from_dict(self._request("GET", "/kill-switch/degradation"))

    def check_operation_allowed(self, operation: str, resource: Optional[str] = None) -> KillSwitchOperationCheck:
        """Check if operation is allowed under current degradation."""
        data = {"operation": operation}
        if resource: data["resource"] = resource
        return KillSwitchOperationCheck.from_dict(self._request("POST", "/kill-switch/check-operation", data=data))

    # ====================================================================
    # P4: Trust Bundle Extended
    # ====================================================================

    def verify_trust_chain(self, bundle_id: str) -> TrustChainVerifyResult:
        """Verify trust chain for a bundle."""
        return TrustChainVerifyResult.from_dict(self._request("POST", "/trust-bundle/verify-chain", data={"bundle_id": bundle_id}))

    def write_evidence(self, evidence_type: str, data: Dict[str, Any]) -> EvidenceWriteResult:
        """Write evidence to trust bundle."""
        return EvidenceWriteResult.from_dict(self._request("POST", "/trust-bundle/write-evidence", data={"evidence_type": evidence_type, "data": data}))

    # ====================================================================
    # P4: Policy Extended
    # ====================================================================

    def compile_policy(self, policy_source: str) -> PolicyCompileResult:
        """Compile a policy from source."""
        return PolicyCompileResult.from_dict(self._request("POST", "/policy/compile", data={"source": policy_source}))

    def get_policy_version_ext(self, policy_id: str, version: Optional[int] = None) -> PolicyVersionInfo:
        """Get a specific policy version."""
        params = {"policy_id": policy_id}
        if version is not None: params["version"] = version
        return PolicyVersionInfo.from_dict(self._request("GET", "/policy/version", params=params))

    def list_policy_versions(self, policy_id: str) -> List[PolicyVersionInfo]:
        """List all versions of a policy."""
        resp = self._request("GET", f"/policy/{policy_id}/versions")
        return [PolicyVersionInfo.from_dict(v) for v in resp.get("versions", [])]

    # ====================================================================
    # P4: RBAC
    # ====================================================================

    def check_permission(self, actor_id: str, action: str, resource: str) -> PermissionCheckResult:
        """Check permission for an actor."""
        return PermissionCheckResult.from_dict(self._request("POST", "/rbac/check", data={"actor_id": actor_id, "action": action, "resource": resource}))

    def get_role_permissions(self, role: str) -> RolePermissionsResult:
        """Get permissions for a role."""
        return RolePermissionsResult.from_dict(self._request("GET", f"/rbac/role/{role}"))

    def check_dual_approval(self, action: str, resource: str) -> DualApprovalCheckResult:
        """Check if dual approval is required."""
        return DualApprovalCheckResult.from_dict(self._request("POST", "/rbac/dual-approval-check", data={"action": action, "resource": resource}))

    def check_approval_isolation(self, approver_id: str, decision_id: str) -> ApprovalIsolationResult:
        """Check approval isolation."""
        return ApprovalIsolationResult.from_dict(self._request("POST", "/rbac/approval-isolation", data={"approver_id": approver_id, "decision_id": decision_id}))

    # ====================================================================
    # P4: Budget Extended
    # ====================================================================

    def get_budget_status_ext(self, budget_id: str) -> BudgetStatusResultP4:
        """Get budget status (extended)."""
        return BudgetStatusResultP4.from_dict(self._request("GET", f"/budget/{budget_id}/status"))

    def check_budget_proceed(self, budget_id: str, amount: float) -> BudgetProceedResult:
        """Check if budget allows proceeding."""
        return BudgetProceedResult.from_dict(self._request("POST", "/budget/check-proceed", data={"budget_id": budget_id, "amount": amount}))

    def check_budget_human(self, budget_id: str, amount: float) -> BudgetHumanCheckResult:
        """Check if budget requires human approval."""
        return BudgetHumanCheckResult.from_dict(self._request("POST", "/budget/check-human", data={"budget_id": budget_id, "amount": amount}))

    # ====================================================================
    # P4: Default Deny
    # ====================================================================

    def check_default_deny(self, action: str, resource: str) -> DefaultDenyOpResult:
        """Check default deny for an operation."""
        return DefaultDenyOpResult.from_dict(self._request("POST", "/default-deny/check", data={"action": action, "resource": resource}))

    def auto_adjust_deny_rules(self) -> DefaultDenyAutoAdjustResult:
        """Auto-adjust default deny rules based on patterns."""
        return DefaultDenyAutoAdjustResult.from_dict(self._request("POST", "/default-deny/auto-adjust"))

    def list_known_actions(self) -> List[KnownActionInfo]:
        """List known actions in the system."""
        resp = self._request("GET", "/default-deny/known-actions")
        return [KnownActionInfo.from_dict(a) for a in resp.get("actions", [])]

    # ====================================================================
    # P4: Metering
    # ====================================================================

    def get_metering_usage(self, period: Optional[str] = None) -> MeteringUsageResult:
        """Get metering usage stats."""
        params = {}
        if period: params["period"] = period
        return MeteringUsageResult.from_dict(self._request("GET", "/metering/usage", params=params))

    def get_metering_quota(self) -> MeteringQuotaResult:
        """Get metering quota status."""
        return MeteringQuotaResult.from_dict(self._request("GET", "/metering/quota"))

    def get_metering_daily(self, date: Optional[str] = None) -> MeteringDailyResult:
        """Get daily metering stats."""
        params = {}
        if date: params["date"] = date
        return MeteringDailyResult.from_dict(self._request("GET", "/metering/daily", params=params))

    def get_metering_subscription(self) -> MeteringSubscriptionResult:
        """Get metering subscription info."""
        return MeteringSubscriptionResult.from_dict(self._request("GET", "/metering/subscription"))

    # ====================================================================
    # P4: Monitoring Extended
    # ====================================================================

    def list_alert_rules(self) -> List[AlertRuleInfo]:
        """List alert rules."""
        resp = self._request("GET", "/monitoring/alert-rules")
        return [AlertRuleInfo.from_dict(r) for r in resp.get("rules", [])]

    def create_alert_rule(self, name: str, condition: str, severity: str) -> AlertRuleInfo:
        """Create an alert rule."""
        return AlertRuleInfo.from_dict(self._request("POST", "/monitoring/alert-rules", data={"name": name, "condition": condition, "severity": severity}))

    def get_metric_history(self, metric: str, period: Optional[str] = None) -> MetricHistoryResult:
        """Get metric history."""
        params = {"metric": metric}
        if period: params["period"] = period
        return MetricHistoryResult.from_dict(self._request("GET", "/monitoring/metric-history", params=params))

    # ====================================================================
    # P4: Experiment Extended
    # ====================================================================

    def list_feature_flags(self) -> List[FeatureFlagInfo]:
        """List feature flags."""
        resp = self._request("GET", "/experiment/feature-flags")
        return [FeatureFlagInfo.from_dict(f) for f in resp.get("flags", [])]

    def toggle_feature_flag(self, flag_id: str, enabled: bool) -> FeatureFlagInfo:
        """Toggle a feature flag."""
        return FeatureFlagInfo.from_dict(self._request("POST", f"/experiment/feature-flags/{flag_id}/toggle", data={"enabled": enabled}))

    def list_canary_deployments(self) -> List[CanaryDeploymentInfo]:
        """List canary deployments."""
        resp = self._request("GET", "/experiment/canary-deployments")
        return [CanaryDeploymentInfo.from_dict(d) for d in resp.get("deployments", [])]

    def create_canary_deployment(self, name: str, traffic_percentage: float, config: Optional[Dict[str, Any]] = None) -> CanaryDeploymentInfo:
        """Create a canary deployment."""
        data = {"name": name, "traffic_percentage": traffic_percentage}
        if config: data["config"] = config
        return CanaryDeploymentInfo.from_dict(self._request("POST", "/experiment/canary-deployments", data=data))

    # ====================================================================
    # P4: Integration Extended
    # ====================================================================

    def list_api_keys(self) -> List[ApiKeyInfo]:
        """List API keys."""
        resp = self._request("GET", "/integration/api-keys")
        return [ApiKeyInfo.from_dict(k) for k in resp.get("keys", [])]

    def create_api_key(self, name: str, scopes: List[str], expires_in_days: Optional[int] = None) -> ApiKeyInfo:
        """Create an API key."""
        data = {"name": name, "scopes": scopes}
        if expires_in_days: data["expires_in_days"] = expires_in_days
        return ApiKeyInfo.from_dict(self._request("POST", "/integration/api-keys", data=data))

    def revoke_api_key(self, key_id: str) -> Dict[str, Any]:
        """Revoke an API key."""
        return self._request("POST", f"/integration/api-keys/{key_id}/revoke")

    def get_api_key_usage(self, key_id: str) -> ApiKeyUsageResult:
        """Get API key usage stats."""
        return ApiKeyUsageResult.from_dict(self._request("GET", f"/integration/api-keys/{key_id}/usage"))

    def list_webhooks(self) -> List[WebhookInfo]:
        """List webhooks."""
        resp = self._request("GET", "/integration/webhooks")
        return [WebhookInfo.from_dict(w) for w in resp.get("webhooks", [])]

    def create_webhook(self, url: str, events: List[str]) -> WebhookInfo:
        """Create a webhook."""
        return WebhookInfo.from_dict(self._request("POST", "/integration/webhooks", data={"url": url, "events": events}))

    def delete_webhook(self, webhook_id: str) -> Dict[str, Any]:
        """Delete a webhook."""
        return self._request("DELETE", f"/integration/webhooks/{webhook_id}")

    def list_integrations(self) -> List[IntegrationListItem]:
        """List all integrations."""
        resp = self._request("GET", "/integration/list")
        return [IntegrationListItem.from_dict(i) for i in resp.get("integrations", [])]

    # ====================================================================
    # P4: TaskQueue Extended
    # ====================================================================

    def get_task_queue_stats_ext(self) -> TaskQueueStatsResult:
        """Get task queue stats."""
        return TaskQueueStatsResult.from_dict(self._request("GET", "/task-queue/stats"))

    def list_dead_letter_items(self) -> List[DeadLetterItemInfo]:
        """List dead letter items."""
        resp = self._request("GET", "/task-queue/dead-letter")
        return [DeadLetterItemInfo.from_dict(d) for d in resp.get("items", [])]

    def retry_dead_letter(self, item_id: str) -> Dict[str, Any]:
        """Retry a dead letter item."""
        return self._request("POST", f"/task-queue/dead-letter/{item_id}/retry")

    def purge_dead_letter(self) -> Dict[str, Any]:
        """Purge all dead letter items."""
        return self._request("POST", "/task-queue/dead-letter/purge")

    # ====================================================================
    # P4: OpenGuard (Content Safety)
    # ====================================================================

    def list_scan_logs(self, limit: Optional[int] = None) -> List[ScanLogInfo]:
        """List scan logs."""
        params = {}
        if limit: params["limit"] = limit
        resp = self._request("GET", "/openguard/scan-logs", params=params)
        return [ScanLogInfo.from_dict(s) for s in resp.get("logs", [])]

    def get_scan_stats_ext(self) -> ScanStatsResult:
        """Get extended scan stats."""
        return ScanStatsResult.from_dict(self._request("GET", "/openguard/scan-stats"))

    def list_content_patterns(self) -> List[ContentPatternInfo]:
        """List content patterns."""
        resp = self._request("GET", "/openguard/patterns")
        return [ContentPatternInfo.from_dict(p) for p in resp.get("patterns", [])]

    def create_custom_pattern(self, name: str, pattern: str, category: str, severity: str) -> CustomPatternInfo:
        """Create a custom pattern."""
        return CustomPatternInfo.from_dict(self._request("POST", "/openguard/patterns", data={"name": name, "pattern": pattern, "category": category, "severity": severity}))

    def delete_custom_pattern(self, pattern_id: str) -> Dict[str, Any]:
        """Delete a custom pattern."""
        return self._request("DELETE", f"/openguard/patterns/{pattern_id}")

    def get_geo_stats(self) -> GeoStatsResult:
        """Get geographic stats."""
        return GeoStatsResult.from_dict(self._request("GET", "/openguard/geo-stats"))

    def list_semantic_models(self) -> List[SemanticModelInfo]:
        """List semantic models."""
        resp = self._request("GET", "/openguard/semantic-models")
        return [SemanticModelInfo.from_dict(m) for m in resp.get("models", [])]

    # ====================================================================
    # P5: Verification Router
    # ====================================================================

    def verify_quick(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /verification/quick-verify."""
        return self._request("POST", "/verification/quick-verify", input)

    def verify_demo(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /verification/demo-verify."""
        return self._request("POST", "/verification/demo-verify", input)

    def verify_fact(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /verification/fact-verify."""
        return self._request("POST", "/verification/fact-verify", input)

    def quick_fact_check(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /verification/quick-fact-check."""
        return self._request("POST", "/verification/quick-fact-check", input)

    def detect_hallucination(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /verification/detect-hallucination."""
        return self._request("POST", "/verification/detect-hallucination", input)

    def quick_hallucination_check(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /verification/quick-hallucination-check."""
        return self._request("POST", "/verification/quick-hallucination-check", input)

    def generate_certificate(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /verification/generate-certificate."""
        return self._request("POST", "/verification/generate-certificate", input)

    def verify_certificate(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /verification/verify-certificate."""
        return self._request("POST", "/verification/verify-certificate", input)

    def get_rollback_policy(self) -> Dict[str, Any]:
        """Call /verification/rollback-policy."""
        return self._request("GET", "/verification/rollback-policy")

    def update_rollback_policy(self) -> Dict[str, Any]:
        """Call /verification/update-rollback-policy."""
        return self._request("POST", "/verification/update-rollback-policy")

    def execute_rollback(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /verification/execute-rollback."""
        return self._request("POST", "/verification/execute-rollback", input)

    def get_latest_safe_checkpoint(self) -> Dict[str, Any]:
        """Call /verification/latest-safe-checkpoint."""
        return self._request("GET", "/verification/latest-safe-checkpoint")

    def create_checkpoint(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /verification/create-checkpoint."""
        return self._request("POST", "/verification/create-checkpoint", input)

    def compare_checkpoints(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /verification/compare-checkpoints."""
        return self._request("POST", "/verification/compare-checkpoints", input)

    def compare_with_current(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /verification/compare-with-current."""
        return self._request("POST", "/verification/compare-with-current", input)

    def quick_compare_latest(self) -> Dict[str, Any]:
        """Call /verification/quick-compare-latest."""
        return self._request("GET", "/verification/quick-compare-latest")

    def generate_diff_report(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /verification/generate-diff-report."""
        return self._request("POST", "/verification/generate-diff-report", input)

    def get_verification_webhook_config(self) -> Dict[str, Any]:
        """Call /verification/webhook-config."""
        return self._request("GET", "/verification/webhook-config")

    def update_verification_webhook_config(self, config: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        """Call /verification/update-webhook-config."""
        return self._request("POST", "/verification/update-webhook-config")

    def configure_slack(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /verification/configure-slack."""
        return self._request("POST", "/verification/configure-slack", input)

    def configure_email(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /verification/configure-email."""
        return self._request("POST", "/verification/configure-email", input)

    def test_notification(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /verification/test-notification."""
        return self._request("POST", "/verification/test-notification", input)

    def send_telegram_test(self) -> Dict[str, Any]:
        """Call /verification/send-telegram-test."""
        return self._request("POST", "/verification/send-telegram-test")

    def get_system_trust_status(self) -> Dict[str, Any]:
        """Call /verification/system-trust-status."""
        return self._request("GET", "/verification/system-trust-status")

    def get_maintenance_mode(self) -> Dict[str, Any]:
        """Call /verification/maintenance-mode."""
        return self._request("GET", "/verification/maintenance-mode")

    def set_maintenance_mode(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /verification/set-maintenance-mode."""
        return self._request("POST", "/verification/set-maintenance-mode", input)

    def get_verification_api_stats(self) -> Dict[str, Any]:
        """Call /verification/api-stats."""
        return self._request("GET", "/verification/api-stats")

    def get_verification_top_endpoints(self) -> Dict[str, Any]:
        """Call /verification/top-endpoints."""
        return self._request("GET", "/verification/top-endpoints")

    def get_verification_daily_stats(self) -> Dict[str, Any]:
        """Call /verification/daily-stats."""
        return self._request("GET", "/verification/daily-stats")

    def get_verification_hourly_heatmap(self) -> Dict[str, Any]:
        """Call /verification/hourly-heatmap."""
        return self._request("GET", "/verification/hourly-heatmap")

    def run_verification_pipeline(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /verification/run-pipeline."""
        return self._request("POST", "/verification/run-pipeline", input)

    def get_chat_models(self) -> Dict[str, Any]:
        """Call /secure-chat/models."""
        return self._request("GET", "/secure-chat/models")

    def get_dangerous_tools(self) -> Dict[str, Any]:
        """Call /secure-chat/dangerous-tools."""
        return self._request("GET", "/secure-chat/dangerous-tools")

    def trial_chat(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /secure-chat/trial-chat."""
        return self._request("POST", "/secure-chat/trial-chat", input)

    def trial_agent_chat(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /secure-chat/trial-agent-chat."""
        return self._request("POST", "/secure-chat/trial-agent-chat", input)

    def secure_chat(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /secure-chat/chat."""
        return self._request("POST", "/secure-chat/chat", input)

    def secure_agent_chat(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /secure-chat/agent-chat."""
        return self._request("POST", "/secure-chat/agent-chat", input)

    def secure_batch_chat(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /secure-chat/batch-chat."""
        return self._request("POST", "/secure-chat/batch-chat", input)

    def create_dispute(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p0/disputes/create."""
        return self._request("POST", "/p0/disputes/create", input)

    def update_dispute_status(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p0/disputes/update-status."""
        return self._request("POST", "/p0/disputes/update-status", input)

    def resolve_dispute(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p0/disputes/resolve."""
        return self._request("POST", "/p0/disputes/resolve", input)

    def p0_check(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p0/check."""
        return self._request("POST", "/p0/check", input)

    def detect_conflict(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p0/detect-conflict."""
        return self._request("POST", "/p0/detect-conflict", input)

    def arbitrate(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p0/arbitrate."""
        return self._request("POST", "/p0/arbitrate", input)

    def list_pending_arbitrations(self) -> Dict[str, Any]:
        """Call /p0/pending-arbitrations."""
        return self._request("GET", "/p0/pending-arbitrations")

    def find_precedents(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p0/find-precedents."""
        return self._request("POST", "/p0/find-precedents", input)

    def create_backup(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p0/create-backup."""
        return self._request("POST", "/p0/create-backup", input)

    def create_restore(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p0/create-restore."""
        return self._request("POST", "/p0/create-restore", input)

    def list_backups(self) -> Dict[str, Any]:
        """Call /p0/list-backups."""
        return self._request("GET", "/p0/list-backups")

    def create_incident(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p0/create-incident."""
        return self._request("POST", "/p0/create-incident", input)

    def update_incident_status(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p0/update-incident-status."""
        return self._request("POST", "/p0/update-incident-status", input)

    def list_p0_alerts(self) -> Dict[str, Any]:
        """Call /p0/list-alerts."""
        return self._request("GET", "/p0/list-alerts")

    def acknowledge_p0_alert(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p0/acknowledge-alert."""
        return self._request("POST", "/p0/acknowledge-alert", input)

    def list_threat_indicators(self) -> Dict[str, Any]:
        """Call /p0/list-threat-indicators."""
        return self._request("GET", "/p0/list-threat-indicators")

    def submit_evidence_ext(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/submit-evidence."""
        return self._request("POST", "/p1p2/submit-evidence", input)

    def check_contract(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/check-contract."""
        return self._request("POST", "/p1p2/check-contract", input)

    def resolve_conflict(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/resolve-conflict."""
        return self._request("POST", "/p1p2/resolve-conflict", input)

    def cognitive_detect(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/detect."""
        return self._request("POST", "/p1p2/detect", input)

    def detect_adversarial_ext(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/detect-adversarial."""
        return self._request("POST", "/p1p2/detect-adversarial", input)

    def check_constraints(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/check-constraints."""
        return self._request("POST", "/p1p2/check-constraints", input)

    def get_cost_status(self) -> Dict[str, Any]:
        """Call /p1p2/cost-status."""
        return self._request("GET", "/p1p2/cost-status")

    def get_sla_metrics_ext(self) -> Dict[str, Any]:
        """Call /p1p2/sla-metrics."""
        return self._request("GET", "/p1p2/sla-metrics")

    def create_p1_p2_bundle(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/create-bundle."""
        return self._request("POST", "/p1p2/create-bundle", input)

    def clear_p1_p2_cache(self) -> Dict[str, Any]:
        """Call /p1p2/clear-cache."""
        return self._request("POST", "/p1p2/clear-cache")

    def record_failure(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/record-failure."""
        return self._request("POST", "/p1p2/record-failure", input)

    def get_pending_suggestions(self) -> Dict[str, Any]:
        """Call /p1p2/pending-suggestions."""
        return self._request("GET", "/p1p2/pending-suggestions")

    def check_forbidden_patterns(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/check-forbidden-patterns."""
        return self._request("POST", "/p1p2/check-forbidden-patterns", input)

    def process_context(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/process-context."""
        return self._request("POST", "/p1p2/process-context", input)

    def filter_items(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/filter-items."""
        return self._request("POST", "/p1p2/filter-items", input)

    def p1p2_write(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/write."""
        return self._request("POST", "/p1p2/write", input)

    def p1p2_search(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/search."""
        return self._request("POST", "/p1p2/search", input)

    def p1p2_check(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/check."""
        return self._request("POST", "/p1p2/check", input)

    def get_today_cost(self) -> Dict[str, Any]:
        """Call /p1p2/today-cost."""
        return self._request("GET", "/p1p2/today-cost")

    def record_event(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/record-event."""
        return self._request("POST", "/p1p2/record-event", input)

    def load_index(self) -> Dict[str, Any]:
        """Call /p1p2/load-index."""
        return self._request("POST", "/p1p2/load-index")

    def log_decision(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/log-decision."""
        return self._request("POST", "/p1p2/log-decision", input)

    def resolve_lifecycle(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/resolve."""
        return self._request("POST", "/p1p2/resolve", input)

    def create_lifecycle(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/create."""
        return self._request("POST", "/p1p2/create", input)

    def enable_lifecycle(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/enable."""
        return self._request("POST", "/p1p2/enable", input)

    def pause_lifecycle(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/pause."""
        return self._request("POST", "/p1p2/pause", input)

    def complete_lifecycle(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/complete."""
        return self._request("POST", "/p1p2/complete", input)

    def rollback_lifecycle(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/rollback."""
        return self._request("POST", "/p1p2/rollback", input)

    def update_lifecycle(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/update."""
        return self._request("POST", "/p1p2/update", input)

    def record_metric(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/record-metric."""
        return self._request("POST", "/p1p2/record-metric", input)

    def evaluate_metric(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/evaluate."""
        return self._request("POST", "/p1p2/evaluate", input)

    def manual_transition(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/manual-transition."""
        return self._request("POST", "/p1p2/manual-transition", input)

    def get_budget_status_ext_ext2(self) -> Dict[str, Any]:
        """Call /p1p2/budget-status."""
        return self._request("GET", "/p1p2/budget-status")

    def compute_rule_health(self) -> Dict[str, Any]:
        """Call /p1p2/compute-rule-health."""
        return self._request("GET", "/p1p2/compute-rule-health")

    def compute_model_risk(self) -> Dict[str, Any]:
        """Call /p1p2/compute-model-risk."""
        return self._request("GET", "/p1p2/compute-model-risk")

    def analyze_reasoning_ext(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/analyze-reasoning."""
        return self._request("POST", "/p1p2/analyze-reasoning", input)

    def check_narrative(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/check-narrative."""
        return self._request("POST", "/p1p2/check-narrative", input)

    def validate_reality(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p1p2/validate-reality."""
        return self._request("POST", "/p1p2/validate-reality", input)

    def create_p3_webhook(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3/webhooks/create."""
        return self._request("POST", "/p3/webhooks/create", input)

    def update_p3_webhook(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3/webhooks/update."""
        return self._request("POST", "/p3/webhooks/update", input)

    def delete_p3_webhook(self, id: str) -> Dict[str, Any]:
        """Call /p3/webhooks/delete."""
        return self._request("POST", "/p3/webhooks/delete")

    def test_p3_webhook(self, id: str) -> Dict[str, Any]:
        """Call /p3/webhooks/test."""
        return self._request("POST", "/p3/webhooks/test")

    def retry_p3_delivery(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3/webhooks/retry-delivery."""
        return self._request("POST", "/p3/webhooks/retry-delivery", input)

    def list_p3_webhook_rules(self) -> Dict[str, Any]:
        """Call /p3/webhooks/list-rules."""
        return self._request("GET", "/p3/webhooks/list-rules")

    def create_p3_webhook_rule(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3/webhooks/create-rule."""
        return self._request("POST", "/p3/webhooks/create-rule", input)

    def update_p3_webhook_rule(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3/webhooks/update-rule."""
        return self._request("POST", "/p3/webhooks/update-rule", input)

    def delete_p3_webhook_rule(self, id: str) -> Dict[str, Any]:
        """Call /p3/webhooks/delete-rule."""
        return self._request("POST", "/p3/webhooks/delete-rule")

    def list_p3_alerts(self) -> Dict[str, Any]:
        """Call /p3/alerts/list."""
        return self._request("GET", "/p3/alerts/list")

    def acknowledge_p3_alert(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3/alerts/acknowledge."""
        return self._request("POST", "/p3/alerts/acknowledge", input)

    def resolve_p3_alert(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3/alerts/resolve."""
        return self._request("POST", "/p3/alerts/resolve", input)

    def create_p3_task(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3/tasks/create."""
        return self._request("POST", "/p3/tasks/create", input)

    def execute_p3_task(self, id: str) -> Dict[str, Any]:
        """Call /p3/tasks/execute."""
        return self._request("POST", "/p3/tasks/execute")

    def cancel_p3_task(self, id: str) -> Dict[str, Any]:
        """Call /p3/tasks/cancel."""
        return self._request("POST", "/p3/tasks/cancel")

    def retry_p3_task(self, id: str) -> Dict[str, Any]:
        """Call /p3/tasks/retry."""
        return self._request("POST", "/p3/tasks/retry")

    def list_p3_integration_configs(self) -> Dict[str, Any]:
        """Call /p3/integrations/list-configs."""
        return self._request("GET", "/p3/integrations/list-configs")

    def create_p3_integration_config(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3/integrations/create-config."""
        return self._request("POST", "/p3/integrations/create-config", input)

    def test_p3_integration_config(self, id: str) -> Dict[str, Any]:
        """Call /p3/integrations/test-config."""
        return self._request("POST", "/p3/integrations/test-config")

    def list_p3_slack_integrations(self) -> Dict[str, Any]:
        """Call /p3/integrations/list-slack."""
        return self._request("GET", "/p3/integrations/list-slack")

    def create_p3_slack_integration(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3/integrations/create-slack."""
        return self._request("POST", "/p3/integrations/create-slack", input)

    def send_p3_test(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3/integrations/send-test."""
        return self._request("POST", "/p3/integrations/send-test", input)

    def dispatch_p3_notification(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3/integrations/dispatch."""
        return self._request("POST", "/p3/integrations/dispatch", input)

    def create_data_asset(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/assets/create."""
        return self._request("POST", "/p3-fusion/assets/create", input)

    def classify_data_ext(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/assets/classify."""
        return self._request("POST", "/p3-fusion/assets/classify", input)

    def trace_data_lineage(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/assets/trace-lineage."""
        return self._request("POST", "/p3-fusion/assets/trace-lineage", input)

    def list_quality_rules(self) -> Dict[str, Any]:
        """Call /p3-fusion/quality/rules."""
        return self._request("GET", "/p3-fusion/quality/rules")

    def execute_quality_check(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/quality/check."""
        return self._request("POST", "/p3-fusion/quality/check", input)

    def detect_pii_ext(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/privacy/detect-pii."""
        return self._request("POST", "/p3-fusion/privacy/detect-pii", input)

    def list_masking_rules(self) -> Dict[str, Any]:
        """Call /p3-fusion/privacy/masking-rules."""
        return self._request("GET", "/p3-fusion/privacy/masking-rules")

    def create_masking_rule(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/privacy/create-masking-rule."""
        return self._request("POST", "/p3-fusion/privacy/create-masking-rule", input)

    def mask_data_ext(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/privacy/mask-data."""
        return self._request("POST", "/p3-fusion/privacy/mask-data", input)

    def create_consent_record(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/privacy/create-consent."""
        return self._request("POST", "/p3-fusion/privacy/create-consent", input)

    def check_consent_ext(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/privacy/check-consent."""
        return self._request("POST", "/p3-fusion/privacy/check-consent", input)

    def list_pi_as(self) -> Dict[str, Any]:
        """Call /p3-fusion/privacy/pias."""
        return self._request("GET", "/p3-fusion/privacy/pias")

    def list_compliance_controls(self) -> Dict[str, Any]:
        """Call /p3-fusion/compliance/controls."""
        return self._request("GET", "/p3-fusion/compliance/controls")

    def run_compliance_check_ext(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/compliance/check."""
        return self._request("POST", "/p3-fusion/compliance/check", input)

    def generate_compliance_report_ext(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/compliance/generate-report."""
        return self._request("POST", "/p3-fusion/compliance/generate-report", input)

    def list_compliance_reports(self) -> Dict[str, Any]:
        """Call /p3-fusion/compliance/reports."""
        return self._request("GET", "/p3-fusion/compliance/reports")

    def analyze_compliance_gaps(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/compliance/analyze-gaps."""
        return self._request("POST", "/p3-fusion/compliance/analyze-gaps", input)

    def list_compliance_gaps(self) -> Dict[str, Any]:
        """Call /p3-fusion/compliance/gaps."""
        return self._request("GET", "/p3-fusion/compliance/gaps")

    def list_report_schedules(self) -> Dict[str, Any]:
        """Call /p3-fusion/scheduler/schedules."""
        return self._request("GET", "/p3-fusion/scheduler/schedules")

    def create_report_schedule(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/scheduler/create."""
        return self._request("POST", "/p3-fusion/scheduler/create", input)

    def update_report_schedule(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/scheduler/update."""
        return self._request("POST", "/p3-fusion/scheduler/update", input)

    def delete_report_schedule(self, id: str) -> Dict[str, Any]:
        """Call /p3-fusion/scheduler/delete."""
        return self._request("POST", "/p3-fusion/scheduler/delete")

    def execute_report(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/scheduler/execute."""
        return self._request("POST", "/p3-fusion/scheduler/execute", input)

    def list_tenants(self) -> Dict[str, Any]:
        """Call /p3-fusion/tenants/list."""
        return self._request("GET", "/p3-fusion/tenants/list")

    def create_tenant(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/tenants/create."""
        return self._request("POST", "/p3-fusion/tenants/create", input)

    def suspend_tenant(self, id: str) -> Dict[str, Any]:
        """Call /p3-fusion/tenants/suspend."""
        return self._request("POST", "/p3-fusion/tenants/suspend")

    def activate_tenant(self, id: str) -> Dict[str, Any]:
        """Call /p3-fusion/tenants/activate."""
        return self._request("POST", "/p3-fusion/tenants/activate")

    def add_tenant_member(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/tenants/add-member."""
        return self._request("POST", "/p3-fusion/tenants/add-member", input)

    def check_tenant_quota(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/tenants/check-quota."""
        return self._request("POST", "/p3-fusion/tenants/check-quota", input)

    def upgrade_tenant_plan(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/tenants/upgrade-plan."""
        return self._request("POST", "/p3-fusion/tenants/upgrade-plan", input)

    def validate_tenant_access(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/tenants/validate-access."""
        return self._request("POST", "/p3-fusion/tenants/validate-access", input)

    def create_fusion_subscription(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/subscriptions/create."""
        return self._request("POST", "/p3-fusion/subscriptions/create", input)

    def cancel_fusion_subscription(self, id: str) -> Dict[str, Any]:
        """Call /p3-fusion/subscriptions/cancel."""
        return self._request("POST", "/p3-fusion/subscriptions/cancel")

    def change_fusion_plan(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/subscriptions/change-plan."""
        return self._request("POST", "/p3-fusion/subscriptions/change-plan", input)

    def list_trust_score_models(self) -> Dict[str, Any]:
        """Call /p3-fusion/trust-score/models."""
        return self._request("GET", "/p3-fusion/trust-score/models")

    def calculate_trust_score_ext(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/trust-score/calculate."""
        return self._request("POST", "/p3-fusion/trust-score/calculate", input)

    def batch_calculate_trust_score(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/trust-score/batch-calculate."""
        return self._request("POST", "/p3-fusion/trust-score/batch-calculate", input)

    def calculate_aggregate_trust_score(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/trust-score/aggregate."""
        return self._request("POST", "/p3-fusion/trust-score/aggregate", input)

    def list_risk_definitions(self) -> Dict[str, Any]:
        """Call /p3-fusion/risk/definitions."""
        return self._request("GET", "/p3-fusion/risk/definitions")

    def assess_risk_ext(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/risk/assess."""
        return self._request("POST", "/p3-fusion/risk/assess", input)

    def create_risk_mitigation(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/risk/create-mitigation."""
        return self._request("POST", "/p3-fusion/risk/create-mitigation", input)

    def report_risk_incident(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/risk/report-incident."""
        return self._request("POST", "/p3-fusion/risk/report-incident", input)

    def detect_risks_ext(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/risk/detect."""
        return self._request("POST", "/p3-fusion/risk/detect", input)

    def activate_policy(self, id: str) -> Dict[str, Any]:
        """Call /p3-fusion/policies/activate."""
        return self._request("POST", "/p3-fusion/policies/activate")

    def deprecate_policy(self, id: str) -> Dict[str, Any]:
        """Call /p3-fusion/policies/deprecate."""
        return self._request("POST", "/p3-fusion/policies/deprecate")

    def rollback_policy_to_version(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/policies/rollback-to-version."""
        return self._request("POST", "/p3-fusion/policies/rollback-to-version", input)

    def detect_policy_conflicts(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/policies/detect-conflicts."""
        return self._request("POST", "/p3-fusion/policies/detect-conflicts", input)

    def list_policy_conflicts(self) -> Dict[str, Any]:
        """Call /p3-fusion/policies/conflicts."""
        return self._request("GET", "/p3-fusion/policies/conflicts")

    def resolve_policy_conflict(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/policies/resolve-conflict."""
        return self._request("POST", "/p3-fusion/policies/resolve-conflict", input)

    def delete_fusion_rule(self, id: str) -> Dict[str, Any]:
        """Call /p3-fusion/automation/delete-rule."""
        return self._request("POST", "/p3-fusion/automation/delete-rule")

    def manual_trigger_fusion(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/automation/manual-trigger."""
        return self._request("POST", "/p3-fusion/automation/manual-trigger", input)

    def publish_fusion_event(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /p3-fusion/automation/publish-event."""
        return self._request("POST", "/p3-fusion/automation/publish-event", input)

    def seed_all_fusion(self) -> Dict[str, Any]:
        """Call /p3-fusion/seed/all."""
        return self._request("POST", "/p3-fusion/seed/all")

    def reset_all_fusion(self) -> Dict[str, Any]:
        """Call /p3-fusion/seed/reset."""
        return self._request("POST", "/p3-fusion/seed/reset")

    def get_rule_stats(self) -> Dict[str, Any]:
        """Call /rules/stats."""
        return self._request("GET", "/rules/stats")

    def delete_rule(self, id: str) -> Dict[str, Any]:
        """Call /rules/delete."""
        return self._request("POST", "/rules/delete")

    def batch_toggle_rules(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /rules/batch-toggle."""
        return self._request("POST", "/rules/batch-toggle", input)

    def test_rule_pattern(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /rules/test-pattern."""
        return self._request("POST", "/rules/test-pattern", input)

    def refresh_rule_cache(self) -> Dict[str, Any]:
        """Call /rules/refresh-cache."""
        return self._request("POST", "/rules/refresh-cache")

    def export_rules_csv(self) -> Dict[str, Any]:
        """Call /rules/export-csv."""
        return self._request("GET", "/rules/export-csv")

    def import_rules_csv(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /rules/import-csv."""
        return self._request("POST", "/rules/import-csv", input)

    def rollback_rule_to_version(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /rules/rollback-to-version."""
        return self._request("POST", "/rules/rollback-to-version", input)

    def get_stripe_products(self) -> Dict[str, Any]:
        """Call /stripe/products."""
        return self._request("GET", "/stripe/products")

    def get_stripe_subscription(self) -> Dict[str, Any]:
        """Call /stripe/subscription."""
        return self._request("GET", "/stripe/subscription")

    def create_stripe_portal_session(self) -> Dict[str, Any]:
        """Call /stripe/create-portal-session."""
        return self._request("POST", "/stripe/create-portal-session")

    def get_stripe_plan_limits(self) -> Dict[str, Any]:
        """Call /stripe/plan-limits."""
        return self._request("GET", "/stripe/plan-limits")

    def format_stripe_price(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /stripe/format-price."""
        return self._request("POST", "/stripe/format-price", input)

    def get_stripe_usage_stats(self) -> Dict[str, Any]:
        """Call /stripe/usage-stats."""
        return self._request("GET", "/stripe/usage-stats")

    def get_stripe_daily_stats(self) -> Dict[str, Any]:
        """Call /stripe/daily-stats."""
        return self._request("GET", "/stripe/daily-stats")

    def get_stripe_endpoint_stats(self) -> Dict[str, Any]:
        """Call /stripe/endpoint-stats."""
        return self._request("GET", "/stripe/endpoint-stats")

    def check_stripe_quota(self) -> Dict[str, Any]:
        """Call /stripe/check-quota."""
        return self._request("GET", "/stripe/check-quota")

    def get_stripe_quota_packs(self) -> Dict[str, Any]:
        """Call /stripe/quota-packs."""
        return self._request("GET", "/stripe/quota-packs")

    def get_stripe_bonus_quota(self) -> Dict[str, Any]:
        """Call /stripe/bonus-quota."""
        return self._request("GET", "/stripe/bonus-quota")

    def create_stripe_quota_pack_checkout(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /stripe/create-quota-pack-checkout."""
        return self._request("POST", "/stripe/create-quota-pack-checkout", input)

    def get_stripe_degrade_config(self) -> Dict[str, Any]:
        """Call /stripe/degrade-config."""
        return self._request("GET", "/stripe/degrade-config")

    def update_stripe_degrade_config(self, config: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        """Call /stripe/update-degrade-config."""
        return self._request("POST", "/stripe/update-degrade-config")

    def check_stripe_quota_with_degrade(self) -> Dict[str, Any]:
        """Call /stripe/check-quota-with-degrade."""
        return self._request("GET", "/stripe/check-quota-with-degrade")

    def get_stripe_quota_prediction(self) -> Dict[str, Any]:
        """Call /stripe/quota-prediction."""
        return self._request("GET", "/stripe/quota-prediction")

    def can_create_stripe_quota_pool(self) -> Dict[str, Any]:
        """Call /stripe/can-create-quota-pool."""
        return self._request("GET", "/stripe/can-create-quota-pool")

    def create_stripe_quota_pool(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /stripe/create-quota-pool."""
        return self._request("POST", "/stripe/create-quota-pool", input)

    def get_stripe_owned_quota_pools(self) -> Dict[str, Any]:
        """Call /stripe/owned-quota-pools."""
        return self._request("GET", "/stripe/owned-quota-pools")

    def get_stripe_joined_quota_pools(self) -> Dict[str, Any]:
        """Call /stripe/joined-quota-pools."""
        return self._request("GET", "/stripe/joined-quota-pools")

    def add_stripe_quota_pool_member(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /stripe/add-quota-pool-member."""
        return self._request("POST", "/stripe/add-quota-pool-member", input)

    def get_stripe_overage_stats(self) -> Dict[str, Any]:
        """Call /stripe/overage-stats."""
        return self._request("GET", "/stripe/overage-stats")

    def get_stripe_overage_pricing(self) -> Dict[str, Any]:
        """Call /stripe/overage-pricing."""
        return self._request("GET", "/stripe/overage-pricing")

    def check_stripe_overage_allowance(self) -> Dict[str, Any]:
        """Call /stripe/check-overage-allowance."""
        return self._request("GET", "/stripe/check-overage-allowance")

    def get_stripe_billing_stats(self) -> Dict[str, Any]:
        """Call /stripe/billing-stats."""
        return self._request("GET", "/stripe/billing-stats")

    def get_stripe_billing_event_weights(self) -> Dict[str, Any]:
        """Call /stripe/billing-event-weights."""
        return self._request("GET", "/stripe/billing-event-weights")

    def get_stripe_trust_bundle_products(self) -> Dict[str, Any]:
        """Call /stripe/trust-bundle-products."""
        return self._request("GET", "/stripe/trust-bundle-products")

    def get_stripe_trust_bundle_balance(self) -> Dict[str, Any]:
        """Call /stripe/trust-bundle-balance."""
        return self._request("GET", "/stripe/trust-bundle-balance")

    def can_issue_trust_bundle(self) -> Dict[str, Any]:
        """Call /stripe/can-issue-trust-bundle."""
        return self._request("GET", "/stripe/can-issue-trust-bundle")

    def can_export_trust_bundle(self) -> Dict[str, Any]:
        """Call /stripe/can-export-trust-bundle."""
        return self._request("GET", "/stripe/can-export-trust-bundle")

    def list_stripe_auditor_accounts(self) -> Dict[str, Any]:
        """Call /stripe/auditor-accounts."""
        return self._request("GET", "/stripe/auditor-accounts")

    def create_stripe_auditor_account(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /stripe/create-auditor-account."""
        return self._request("POST", "/stripe/create-auditor-account", input)

    def update_stripe_auditor_account(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /stripe/update-auditor-account."""
        return self._request("POST", "/stripe/update-auditor-account", input)

    def revoke_stripe_auditor_account(self, id: str) -> Dict[str, Any]:
        """Call /stripe/revoke-auditor-account."""
        return self._request("POST", "/stripe/revoke-auditor-account")

    def regenerate_stripe_auditor_token(self, id: str) -> Dict[str, Any]:
        """Call /stripe/regenerate-auditor-token."""
        return self._request("POST", "/stripe/regenerate-auditor-token")

    def calculate_stripe_auditor_account_cost(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /stripe/calculate-auditor-account-cost."""
        return self._request("POST", "/stripe/calculate-auditor-account-cost", input)

    def list_stripe_environment_configs(self) -> Dict[str, Any]:
        """Call /stripe/environment-configs."""
        return self._request("GET", "/stripe/environment-configs")

    def create_stripe_environment_config(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /stripe/create-environment-config."""
        return self._request("POST", "/stripe/create-environment-config", input)

    def update_stripe_environment_config(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /stripe/update-environment-config."""
        return self._request("POST", "/stripe/update-environment-config", input)

    def get_stripe_deployment_addon_catalog(self) -> Dict[str, Any]:
        """Call /stripe/deployment-addon-catalog."""
        return self._request("GET", "/stripe/deployment-addon-catalog")

    def list_stripe_deployment_addons(self) -> Dict[str, Any]:
        """Call /stripe/deployment-addons."""
        return self._request("GET", "/stripe/deployment-addons")

    def create_stripe_deployment_subscription(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /stripe/create-deployment-subscription."""
        return self._request("POST", "/stripe/create-deployment-subscription", input)

    def list_stripe_user_deployment_subscriptions(self) -> Dict[str, Any]:
        """Call /stripe/user-deployment-subscriptions."""
        return self._request("GET", "/stripe/user-deployment-subscriptions")

    def update_stripe_deployment_subscription_status(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /stripe/update-deployment-subscription-status."""
        return self._request("POST", "/stripe/update-deployment-subscription-status", input)

    def calculate_stripe_deployment_addons_cost(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /stripe/calculate-deployment-addons-cost."""
        return self._request("POST", "/stripe/calculate-deployment-addons-cost", input)

    def create_stripe_deployment_addon_checkout(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /stripe/create-deployment-addon-checkout."""
        return self._request("POST", "/stripe/create-deployment-addon-checkout", input)

    def sync_stripe_deployment_addon_subscriptions(self) -> Dict[str, Any]:
        """Call /stripe/sync-deployment-addon-subscriptions."""
        return self._request("POST", "/stripe/sync-deployment-addon-subscriptions")

    def get_stripe_enterprise_pricing_config(self) -> Dict[str, Any]:
        """Call /stripe/enterprise-pricing-config."""
        return self._request("GET", "/stripe/enterprise-pricing-config")

    def create_stripe_enterprise_checkout(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Call /stripe/create-enterprise-checkout."""
        return self._request("POST", "/stripe/create-enterprise-checkout", input)


    # ====================================================================
    # Convenience: Full Lifecycle
    # ====================================================================


    
    # ── P7: Final 3 procedures for 100% coverage ──

    def aggregated_health(self, **kwargs) -> dict:
        """Get aggregated health status of all SOVR subsystems."""
        return self._call("sovr.healthCheck.aggregatedHealth", kwargs)

    def role_request_stats(self, **kwargs) -> dict:
        """Get role request statistics for tenant admin."""
        return self._call("sovr.roleRequestStats", kwargs)

    def verify_im_channel(self, channel_id: int) -> dict:
        """Verify an IM notification channel."""
        return self._call("sovr.verifyIMChannel", {"channelId": channel_id})

    # ════════════════════════════════════════════════════════════════
    # P6: 100% Coverage Sprint — 682 additional methods
    # ════════════════════════════════════════════════════════════════


    # ═══ P6: sovr (18 methods) ═══
    def sovr_check_operation(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/sovr/check-operation", params=params or {})
    def sovr_consume_quota(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/sovr/consume-quota", params=params or {})
    def sovr_create_flag(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/sovr/create-flag", json_data=params or {})
    def sovr_create_session(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/sovr/create-session", json_data=params or {})
    def sovr_create_suite(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/sovr/create-suite", json_data=params or {})
    def sovr_create_version(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/sovr/create-version", json_data=params or {})
    def sovr_export_csv(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/sovr/export-c-s-v", json_data=params or {})
    def sovr_get(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/sovr/get", params=params or {})
    def sovr_get_by_id(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/sovr/get-by-id", params=params or {})
    def sovr_get_latest_runs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/sovr/get-latest-runs", params=params or {})
    def sovr_get_runs_by_suite(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/sovr/get-runs-by-suite", params=params or {})
    def sovr_get_suite(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/sovr/get-suite", params=params or {})
    def sovr_list_by_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/sovr/list-by-status", params=params or {})
    def sovr_list_sessions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/sovr/list-sessions", params=params or {})
    def sovr_list_suites(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/sovr/list-suites", params=params or {})
    def sovr_run_suite(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/sovr/run-suite", params=params or {})
    def sovr_update_level(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/sovr/update-level", json_data=params or {})
    def sovr_verify_chain(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/sovr/verify-chain", params=params or {})

    # ═══ P6: abTest (3 methods) ═══
    def ab_test_get_test_results(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/abTest/get-test-results", params=params or {})
    def ab_test_get_variant(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/abTest/get-variant", params=params or {})
    def ab_test_track_event(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/abTest/track-event", params=params or {})

    # ═══ P6: agentIntegration (4 methods) ═══
    def agent_integration_configure_callback(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/agentIntegration/configure-callback", json_data=params or {})
    def agent_integration_get_integration_guide(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/agentIntegration/get-integration-guide", params=params or {})
    def agent_integration_register(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/agentIntegration/register", params=params or {})
    def agent_integration_report_operation(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/agentIntegration/report-operation", params=params or {})

    # ═══ P6: aiChat (3 methods) ═══
    def ai_chat_get_faq_analytics(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/aiChat/get-faq-analytics", params=params or {})
    def ai_chat_get_or_create_session(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/aiChat/get-or-create-session", params=params or {})
    def ai_chat_mark_helpful(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/aiChat/mark-helpful", params=params or {})

    # ═══ P6: apiKey (12 methods) ═══
    def api_key_batch_delete(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/apiKey/batch-delete", json_data=params or {})
    def api_key_batch_disable(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/apiKey/batch-disable", json_data=params or {})
    def api_key_batch_enable(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/apiKey/batch-enable", json_data=params or {})
    def api_key_export_usage_logs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/apiKey/export-usage-logs", json_data=params or {})
    def api_key_get(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/apiKey/get", params=params or {})
    def api_key_get_alert_settings(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/apiKey/get-alert-settings", params=params or {})
    def api_key_get_audit_logs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/apiKey/get-audit-logs", params=params or {})
    def api_key_get_usage(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/apiKey/get-usage", params=params or {})
    def api_key_rate_limit_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/apiKey/rate-limit-status", params=params or {})
    def api_key_rate_limiter_health(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/apiKey/rate-limiter-health", params=params or {})
    def api_key_renew(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/apiKey/renew", params=params or {})
    def api_key_save_alert_settings(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/apiKey/save-alert-settings", json_data=params or {})

    # ═══ P6: billing (7 methods) ═══
    def billing_export_bill(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/billing/export-bill", json_data=params or {})
    def billing_get_overage_bill(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/billing/get-overage-bill", params=params or {})
    def billing_get_quota_prediction(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/billing/get-quota-prediction", params=params or {})
    def billing_get_quota_statuses(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/billing/get-quota-statuses", params=params or {})
    def billing_get_quota_trends(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/billing/get-quota-trends", params=params or {})
    def billing_get_usage_summary(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/billing/get-usage-summary", params=params or {})
    def billing_get_usage_trend(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/billing/get-usage-trend", params=params or {})

    # ═══ P6: chat (1 methods) ═══
    def secure_chat_get_models(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/chat/get-models", params=params or {})

    # ═══ P6: core (363 methods) ═══
    def core_access_logs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/access-logs", params=params or {})
    def core_acknowledge_channel_alert(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/acknowledge-channel-alert", params=params or {})
    def core_adapters(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/adapters", params=params or {})
    def core_add_evidence(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/add-evidence", json_data=params or {})
    def core_all_kill_switch_approvals(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/all-kill-switch-approvals", params=params or {})
    def core_apply_custom_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/apply-custom-template", params=params or {})
    def core_apply_permission_preset(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/apply-permission-preset", params=params or {})
    def core_apply_preset(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/apply-preset", params=params or {})
    def core_apply_quiet_hours_preset(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/apply-quiet-hours-preset", params=params or {})
    def core_apply_threshold_preset(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/apply-threshold-preset", params=params or {})
    def core_approve(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/approve", params=params or {})
    def core_archive(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/archive", params=params or {})
    def core_archive_test(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/archive-test", params=params or {})
    def core_auto_generate_reports(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/auto-generate-reports", params=params or {})
    def core_batch_acknowledge(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/batch-acknowledge", json_data=params or {})
    def core_batch_create_for_decisions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/batch-create-for-decisions", json_data=params or {})
    def core_batch_enqueue(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/batch-enqueue", json_data=params or {})
    def core_batch_export(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/batch-export", json_data=params or {})
    def core_batch_import(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/batch-import", json_data=params or {})
    def core_batch_import_dry_run(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/batch-import-dry-run", json_data=params or {})
    def core_batch_manual_re_evaluate(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/batch-manual-re-evaluate", json_data=params or {})
    def core_batch_re_evaluate(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/batch-re-evaluate", json_data=params or {})
    def core_batch_update_permission_matrix(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/batch-update-permission-matrix", json_data=params or {})
    def core_batch_update_roles(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/batch-update-roles", json_data=params or {})
    def core_billing_records(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/billing-records", params=params or {})
    def core_billing_summary(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/billing-summary", params=params or {})
    def core_broadcast_im_message(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/broadcast-i-m-message", params=params or {})
    def core_by_category(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/by-category", params=params or {})
    def core_bypass_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/bypass-stats", params=params or {})
    def core_cancel_import_task(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/cancel-import-task", json_data=params or {})
    def core_cancel_queued(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/cancel-queued", json_data=params or {})
    def core_cancel_role_request(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/cancel-role-request", json_data=params or {})
    def core_categories(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/categories", params=params or {})
    def core_chained_logs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/chained-logs", params=params or {})
    def core_change_password(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/change-password", json_data=params or {})
    def core_check_all_channels_health(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/check-all-channels-health", params=params or {})
    def core_check_all_running_tests(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/check-all-running-tests", params=params or {})
    def core_check_bypassed(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/check-bypassed", params=params or {})
    def core_check_channel_health(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/check-channel-health", params=params or {})
    def core_check_circuit_breaker_changes(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/check-circuit-breaker-changes", params=params or {})
    def core_check_decisions_have_bundles(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/check-decisions-have-bundles", params=params or {})
    def core_check_expiring_keys(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/check-expiring-keys", params=params or {})
    def core_check_kill_switch_changes(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/check-kill-switch-changes", params=params or {})
    def core_check_quota_exhaustion(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/check-quota-exhaustion", params=params or {})
    def core_check_rate_limit(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/check-rate-limit", params=params or {})
    def core_circuit_breaker_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/circuit-breaker-status", params=params or {})
    def core_cleanup_executions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/cleanup-executions", params=params or {})
    def core_cleanup_expired(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/cleanup-expired", params=params or {})
    def core_cleanup_expired_archives(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/cleanup-expired-archives", params=params or {})
    def core_cleanup_merkle_tree_caches(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/cleanup-merkle-tree-caches", params=params or {})
    def core_cleanup_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/cleanup-stats", params=params or {})
    def core_clear_cache(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/clear-cache", json_data=params or {})
    def core_code_fix_gate(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/code-fix-gate", params=params or {})
    def core_code_review(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/code-review", params=params or {})
    def core_compare_archives(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/compare-archives", params=params or {})
    def core_compare_versions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/compare-versions", params=params or {})
    def core_comprehensive_health_check(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/comprehensive-health-check", params=params or {})
    def core_control_plane(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/control-plane", params=params or {})
    def core_create_async_import_task(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/create-async-import-task", json_data=params or {})
    def core_create_batch_export(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/create-batch-export", json_data=params or {})
    def core_create_batch_test(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/create-batch-test", json_data=params or {})
    def core_create_cleanup_policy(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/create-cleanup-policy", json_data=params or {})
    def core_create_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/create-config", json_data=params or {})
    def core_create_custom_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/create-custom-template", json_data=params or {})
    def core_create_for_decision(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/create-for-decision", json_data=params or {})
    def core_create_key(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/create-key", json_data=params or {})
    def core_create_kill_switch_approval(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/create-kill-switch-approval", json_data=params or {})
    def core_create_report_subscription(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/create-report-subscription", json_data=params or {})
    def core_create_role_request(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/create-role-request", json_data=params or {})
    def core_create_rule_from_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/create-rule-from-template", json_data=params or {})
    def core_create_share_link(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/create-share-link", json_data=params or {})
    def core_create_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/create-template", json_data=params or {})
    def core_create_weights(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/create-weights", json_data=params or {})
    def core_db_tables(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/db-tables", params=params or {})
    def core_default_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/default-template", params=params or {})
    def core_demo_evaluate(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/demo-evaluate", params=params or {})
    def core_deployment_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/deployment-history", params=params or {})
    def core_deployment_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/deployment-stats", params=params or {})
    def core_deprecate_key(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/deprecate-key", params=params or {})
    def core_detail_with_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/detail-with-history", params=params or {})
    def core_download_batch_export(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/download-batch-export", params=params or {})
    def core_download_bundle_pdf(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/download-bundle-pdf", params=params or {})
    def core_dry_run(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/dry-run", params=params or {})
    def core_dynamic_adapter_configs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/dynamic-adapter-configs", params=params or {})
    def core_engine_activate(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/engine-activate", params=params or {})
    def core_engine_deactivate(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/engine-deactivate", params=params or {})
    def core_engine_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/engine-status", params=params or {})
    def core_enhanced_review(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/enhanced-review", params=params or {})
    def core_enqueue(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/enqueue", params=params or {})
    def core_evaluation_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/evaluation-history", params=params or {})
    def core_evaluation_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/evaluation-stats", params=params or {})
    def core_event_types(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/event-types", params=params or {})
    def core_evidence_chain(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/evidence-chain", params=params or {})
    def core_evidence_weights(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/evidence-weights", params=params or {})
    def core_execute_batch_test(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/execute-batch-test", params=params or {})
    def core_export_cleanup_report_csv(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/export-cleanup-report-csv", json_data=params or {})
    def core_export_json(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/export-json", json_data=params or {})
    def core_export_pdf(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/export-pdf", json_data=params or {})
    def core_export_report(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/export-report", json_data=params or {})
    def core_export_report_json(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/export-report-json", json_data=params or {})
    def core_export_report_markdown(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/export-report-markdown", json_data=params or {})
    def core_export_report_pdf(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/export-report-pdf", json_data=params or {})
    def core_featured(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/featured", params=params or {})
    def core_find_matching_rules(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/find-matching-rules", params=params or {})
    def core_forgot_password(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/forgot-password", params=params or {})
    def core_full_review(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/full-review", params=params or {})
    def core_generate_analysis_report(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/generate-analysis-report", params=params or {})
    def core_generate_api_key(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/generate-api-key", params=params or {})
    def core_generate_cleanup_report(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/generate-cleanup-report", params=params or {})
    def core_generate_coverage_report(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/generate-coverage-report", params=params or {})
    def core_generate_pdf_content(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/generate-pdf-content", params=params or {})
    def core_generate_quote_pdf(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/generate-quote-pdf", params=params or {})
    def core_get(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get", params=params or {})
    def core_get_ab_test_detail(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-ab-test-detail", params=params or {})
    def core_get_ab_test_email_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-ab-test-email-template", params=params or {})
    def core_get_ab_test_email_templates(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-ab-test-email-templates", params=params or {})
    def core_get_ab_test_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-ab-test-stats", params=params or {})
    def core_get_alert_threshold(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-alert-threshold", params=params or {})
    def core_get_all_channels_health_trend(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-all-channels-health-trend", params=params or {})
    def core_get_all_rules_trigger_summary(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-all-rules-trigger-summary", params=params or {})
    def core_get_archive(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-archive", params=params or {})
    def core_get_archive_by_test_id(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-archive-by-test-id", params=params or {})
    def core_get_archive_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-archive-stats", params=params or {})
    def core_get_archives(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-archives", params=params or {})
    def core_get_auto_trigger_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-auto-trigger-config", params=params or {})
    def core_get_auto_trigger_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-auto-trigger-status", params=params or {})
    def core_get_available_variables(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-available-variables", params=params or {})
    def core_get_batch_export_file(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-batch-export-file", params=params or {})
    def core_get_batch_export_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-batch-export-status", params=params or {})
    def core_get_by_id(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-by-id", params=params or {})
    def core_get_by_request_id(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-by-request-id", params=params or {})
    def core_get_by_slug(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-by-slug", params=params or {})
    def core_get_channel_health_trend(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-channel-health-trend", params=params or {})
    def core_get_cleanup_report(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-cleanup-report", params=params or {})
    def core_get_cleanup_report_summary(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-cleanup-report-summary", params=params or {})
    def core_get_cleanup_settings(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-cleanup-settings", params=params or {})
    def core_get_current_merkle_root(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-current-merkle-root", params=params or {})
    def core_get_custom_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-custom-template", params=params or {})
    def core_get_daily_quota_summary(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-daily-quota-summary", params=params or {})
    def core_get_daily_usage(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-daily-usage", params=params or {})
    def core_get_decision_score(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-decision-score", params=params or {})
    def core_get_default_email_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-default-email-template", params=params or {})
    def core_get_default_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-default-template", params=params or {})
    def core_get_default_threshold_policy(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-default-threshold-policy", params=params or {})
    def core_get_delivery_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-delivery-history", params=params or {})
    def core_get_detailed_version_diff(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-detailed-version-diff", params=params or {})
    def core_get_expiry_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-expiry-status", params=params or {})
    def core_get_filter_options(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-filter-options", params=params or {})
    def core_get_fix_suggestion(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-fix-suggestion", params=params or {})
    def core_get_im_channel(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-i-m-channel", params=params or {})
    def core_get_im_channels(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-i-m-channels", params=params or {})
    def core_get_im_message_logs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-i-m-message-logs", params=params or {})
    def core_get_import_task(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-import-task", params=params or {})
    def core_get_import_task_items(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-import-task-items", params=params or {})
    def core_get_key(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-key", params=params or {})
    def core_get_key_audit_logs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-key-audit-logs", params=params or {})
    def core_get_key_usage_logs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-key-usage-logs", params=params or {})
    def core_get_latest_quota_usage(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-latest-quota-usage", params=params or {})
    def core_get_latest_version(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-latest-version", params=params or {})
    def core_get_merkle_task_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-merkle-task-status", params=params or {})
    def core_get_mock_data_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-mock-data-template", params=params or {})
    def core_get_pending_silenced_count(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-pending-silenced-count", params=params or {})
    def core_get_preset(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-preset", params=params or {})
    def core_get_presets(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-presets", params=params or {})
    def core_get_quiet_hours(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-quiet-hours", params=params or {})
    def core_get_quiet_hours_presets(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-quiet-hours-presets", params=params or {})
    def core_get_quota_alerts(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-quota-alerts", params=params or {})
    def core_get_quota_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-quota-history", params=params or {})
    def core_get_quota_usage(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-quota-usage", params=params or {})
    def core_get_report_data(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-report-data", params=params or {})
    def core_get_retry_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-retry-config", params=params or {})
    def core_get_rule_trigger_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-rule-trigger-stats", params=params or {})
    def core_get_rule_trigger_trend(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-rule-trigger-trend", params=params or {})
    def core_get_rule_versions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-rule-versions", params=params or {})
    def core_get_rules_trigger_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-rules-trigger-stats", params=params or {})
    def core_get_share_link_access_logs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-share-link-access-logs", params=params or {})
    def core_get_share_link_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-share-link-stats", params=params or {})
    def core_get_share_link_usage(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-share-link-usage", params=params or {})
    def core_get_share_links(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-share-links", params=params or {})
    def core_get_silenced_notifications(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-silenced-notifications", params=params or {})
    def core_get_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-stats", params=params or {})
    def core_get_summary_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-summary-history", params=params or {})
    def core_get_task_calendar(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-task-calendar", params=params or {})
    def core_get_task_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-task-stats", params=params or {})
    def core_get_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-template", params=params or {})
    def core_get_template_import_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-template-import-history", params=params or {})
    def core_get_template_variables(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-template-variables", params=params or {})
    def core_get_tenant_key_audit_logs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-tenant-key-audit-logs", params=params or {})
    def core_get_test_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-test-history", params=params or {})
    def core_get_threshold_policy(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-threshold-policy", params=params or {})
    def core_get_threshold_presets(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-threshold-presets", params=params or {})
    def core_get_timezones(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-timezones", params=params or {})
    def core_get_usage_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-usage-stats", params=params or {})
    def core_get_user_rule_subscriptions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-user-rule-subscriptions", params=params or {})
    def core_get_user_share_links(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-user-share-links", params=params or {})
    def core_get_vapid_key(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-vapid-key", params=params or {})
    def core_get_vault_tenant(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-vault-tenant", params=params or {})
    def core_get_version(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-version", params=params or {})
    def core_get_version_detail(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-version-detail", params=params or {})
    def core_get_version_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-version-history", params=params or {})
    def core_get_weights(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-weights", params=params or {})
    def core_get_weights_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/get-weights-history", params=params or {})
    def core_has_password(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/has-password", params=params or {})
    def core_hot_load_events(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/hot-load-events", params=params or {})
    def core_hot_loader_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/hot-loader-status", params=params or {})
    def core_im_channel_health(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/im-channel-health", params=params or {})
    def core_import_events_from_audit_logs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/import-events-from-audit-logs", json_data=params or {})
    def core_import_events_from_csv(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/import-events-from-csv", json_data=params or {})
    def core_import_events_from_json(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/import-events-from-json", json_data=params or {})
    def core_import_from_share_link(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/import-from-share-link", json_data=params or {})
    def core_increment_usage(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/increment-usage", params=params or {})
    def core_init_built_in_templates(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/init-built-in-templates", params=params or {})
    def core_init_preset_templates(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/init-preset-templates", params=params or {})
    def core_initialize_presets(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/initialize-presets", params=params or {})
    def core_kill_switch_approval_detail(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/kill-switch-approval-detail", params=params or {})
    def core_linked(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/linked", params=params or {})
    def core_list_ab_tests(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-ab-tests", params=params or {})
    def core_list_alert_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-alert-history", params=params or {})
    def core_list_alert_thresholds(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-alert-thresholds", params=params or {})
    def core_list_all_configs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-all-configs", params=params or {})
    def core_list_analysis_reports(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-analysis-reports", params=params or {})
    def core_list_api_keys(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-api-keys", params=params or {})
    def core_list_batch_exports(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-batch-exports", params=params or {})
    def core_list_batch_tests(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-batch-tests", params=params or {})
    def core_list_cleanup_executions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-cleanup-executions", params=params or {})
    def core_list_cleanup_policies(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-cleanup-policies", params=params or {})
    def core_list_cleanup_reports(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-cleanup-reports", params=params or {})
    def core_list_configs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-configs", params=params or {})
    def core_list_custom_templates(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-custom-templates", params=params or {})
    def core_list_delivery_logs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-delivery-logs", params=params or {})
    def core_list_frozen(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-frozen", params=params or {})
    def core_list_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-history", params=params or {})
    def core_list_import_tasks(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-import-tasks", params=params or {})
    def core_list_keys(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-keys", params=params or {})
    def core_list_queue(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-queue", params=params or {})
    def core_list_report_subscriptions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-report-subscriptions", params=params or {})
    def core_list_share_links(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-share-links", params=params or {})
    def core_list_subscriptions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-subscriptions", params=params or {})
    def core_list_templates(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-templates", params=params or {})
    def core_list_test_events(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-test-events", params=params or {})
    def core_list_versions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/list-versions", params=params or {})
    def core_load_active_dsl(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/load-active-d-s-l", params=params or {})
    def core_login(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/login", params=params or {})
    def core_logout(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/logout", params=params or {})
    def core_manifest(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/manifest", params=params or {})
    def core_manifests(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/manifests", params=params or {})
    def core_manual_re_evaluate(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/manual-re-evaluate", params=params or {})
    def core_me(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/me", params=params or {})
    def core_my_role_requests(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/my-role-requests", params=params or {})
    def core_my_share_links(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/my-share-links", params=params or {})
    def core_network_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/network-stats", params=params or {})
    def core_overview(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/overview", params=params or {})
    def core_parse_variables(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/parse-variables", params=params or {})
    def core_pending_bypass_requests(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/pending-bypass-requests", params=params or {})
    def core_pending_deployments(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/pending-deployments", params=params or {})
    def core_pending_kill_switch_approvals(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/pending-kill-switch-approvals", params=params or {})
    def core_permission_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/permission-history", params=params or {})
    def core_permission_matrix(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/permission-matrix", params=params or {})
    def core_permission_preset_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/permission-preset-template", params=params or {})
    def core_permission_preset_templates(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/permission-preset-templates", params=params or {})
    def core_persisted_adapters(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/persisted-adapters", params=params or {})
    def core_persistence_ready(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/persistence-ready", params=params or {})
    def core_preset_definitions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/preset-definitions", params=params or {})
    def core_preview_cleanup(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/preview-cleanup", params=params or {})
    def core_preview_email_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/preview-email-template", params=params or {})
    def core_preview_eval(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/preview-eval", params=params or {})
    def core_preview_permission_changes(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/preview-permission-changes", params=params or {})
    def core_preview_permission_preset(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/preview-permission-preset", params=params or {})
    def core_preview_report(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/preview-report", params=params or {})
    def core_preview_summary(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/preview-summary", params=params or {})
    def core_preview_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/preview-template", params=params or {})
    def core_preview_template_rendering(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/preview-template-rendering", params=params or {})
    def core_process_all_summaries(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/process-all-summaries", json_data=params or {})
    def core_process_import_batch(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/process-import-batch", json_data=params or {})
    def core_process_queue(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/process-queue", json_data=params or {})
    def core_quota_predictions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/quota-predictions", params=params or {})
    def core_recalculate_score(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/recalculate-score", params=params or {})
    def core_record_code_fix(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/record-code-fix", json_data=params or {})
    def core_record_usage(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/record-usage", json_data=params or {})
    def core_register(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/register", params=params or {})
    def core_register_action_risk(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/register-action-risk", params=params or {})
    def core_register_resource_sensitivity(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/register-resource-sensitivity", params=params or {})
    def core_render_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/render-template", params=params or {})
    def core_request_bypass(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/request-bypass", params=params or {})
    def core_resend_subscription_confirmation(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/resend-subscription-confirmation", params=params or {})
    def core_resend_verification_email(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/resend-verification-email", params=params or {})
    def core_reset_alert_threshold(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/reset-alert-threshold", json_data=params or {})
    def core_reset_failure_count(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/reset-failure-count", json_data=params or {})
    def core_reset_password(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/reset-password", json_data=params or {})
    def core_restore_version(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/restore-version", params=params or {})
    def core_retry_failed(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/retry-failed", json_data=params or {})
    def core_review(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/review", params=params or {})
    def core_revoke_key(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/revoke-key", json_data=params or {})
    def core_revoke_share_link(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/revoke-share-link", json_data=params or {})
    def core_risk_distribution(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/risk-distribution", params=params or {})
    def core_role_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/role-history", params=params or {})
    def core_role_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/role-stats", params=params or {})
    def core_rollback_permission_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/rollback-permission-config", json_data=params or {})
    def core_rollback_to_version(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/rollback-to-version", json_data=params or {})
    def core_rollback_weights(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/rollback-weights", json_data=params or {})
    def core_rotate_key(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/rotate-key", params=params or {})
    def core_run_cleanup(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/run-cleanup", params=params or {})
    def core_run_expiry_check(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/run-expiry-check", params=params or {})
    def core_save_active_dsl(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/save-active-d-s-l", json_data=params or {})
    def core_save_alert_threshold(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/save-alert-threshold", json_data=params or {})
    def core_save_version(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/save-version", json_data=params or {})
    def core_schedule_historical_merkle_computation(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/schedule-historical-merkle-computation", params=params or {})
    def core_schedule_merkle_computation(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/schedule-merkle-computation", params=params or {})
    def core_send_im_message(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/send-i-m-message", json_data=params or {})
    def core_send_test(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/send-test", json_data=params or {})
    def core_set_enabled(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/set-enabled", json_data=params or {})
    def core_set_password(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/set-password", json_data=params or {})
    def core_simulate_threshold_change(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/simulate-threshold-change", params=params or {})
    def core_submit_feedback(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/submit-feedback", params=params or {})
    def core_submit_fix(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/submit-fix", params=params or {})
    def core_subscribe(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/subscribe", params=params or {})
    def core_sufficiency_thresholds(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/sufficiency-thresholds", params=params or {})
    def core_summary(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/summary", params=params or {})
    def core_test_all_rules(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/test-all-rules", json_data=params or {})
    def core_test_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/test-history", json_data=params or {})
    def core_time_ranges(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/time-ranges", params=params or {})
    def core_tls_check_policy(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/tls-check-policy", params=params or {})
    def core_tls_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/tls-history", params=params or {})
    def core_tls_inspect(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/tls-inspect", params=params or {})
    def core_tls_policy(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/tls-policy", params=params or {})
    def core_tls_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/tls-stats", params=params or {})
    def core_toggle_report_subscription(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/toggle-report-subscription", json_data=params or {})
    def core_top_actions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/top-actions", params=params or {})
    def core_top_policies(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/top-policies", params=params or {})
    def core_trigger_auto_analysis(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/trigger-auto-analysis", json_data=params or {})
    def core_trigger_summary(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/trigger-summary", json_data=params or {})
    def core_unlink(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/unlink", params=params or {})
    def core_unsubscribe(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/unsubscribe", params=params or {})
    def core_update_all_quiet_hours(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/update-all-quiet-hours", json_data=params or {})
    def core_update_archive(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/update-archive", json_data=params or {})
    def core_update_cleanup_policy(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/update-cleanup-policy", json_data=params or {})
    def core_update_cleanup_settings(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/update-cleanup-settings", json_data=params or {})
    def core_update_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/update-config", json_data=params or {})
    def core_update_custom_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/update-custom-template", json_data=params or {})
    def core_update_permission_matrix(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/update-permission-matrix", json_data=params or {})
    def core_update_preferences(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/update-preferences", json_data=params or {})
    def core_update_quiet_hours(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/update-quiet-hours", json_data=params or {})
    def core_update_report_subscription(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/update-report-subscription", json_data=params or {})
    def core_update_retry_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/update-retry-config", json_data=params or {})
    def core_update_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/update-status", json_data=params or {})
    def core_update_subscription(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/update-subscription", json_data=params or {})
    def core_update_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/update-template", json_data=params or {})
    def core_update_threshold_policy(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/update-threshold-policy", json_data=params or {})
    def core_update_user_rule_subscription(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/update-user-rule-subscription", json_data=params or {})
    def core_usage_snapshots(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/usage-snapshots", params=params or {})
    def core_validate_dsl(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/validate-d-s-l", json_data=params or {})
    def core_validate_filters(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/validate-filters", json_data=params or {})
    def core_validate_import(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/validate-import", json_data=params or {})
    def core_validate_share_link(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/validate-share-link", json_data=params or {})
    def core_validate_variables(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/core/validate-variables", json_data=params or {})
    def core_vault_tenant_usage(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/vault-tenant-usage", params=params or {})
    def core_vault_tenants(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/vault-tenants", params=params or {})
    def core_verify_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/verify-config", params=params or {})
    def core_verify_delivery(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/verify-delivery", params=params or {})
    def core_verify_email(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/verify-email", params=params or {})
    def core_verify_evidence(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/verify-evidence", params=params or {})
    def core_webhook_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/webhook-history", params=params or {})
    def core_webhook_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/core/webhook-stats", params=params or {})

    # ═══ P6: enterpriseQuote (9 methods) ═══
    def enterprise_quote_get_by_id(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/enterpriseQuote/get-by-id", params=params or {})
    def enterprise_quote_get_scenarios(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/enterpriseQuote/get-scenarios", params=params or {})
    def enterprise_quote_get_stale_quotes(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/enterpriseQuote/get-stale-quotes", params=params or {})
    def enterprise_quote_get_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/enterpriseQuote/get-stats", params=params or {})
    def enterprise_quote_get_tiers(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/enterpriseQuote/get-tiers", params=params or {})
    def enterprise_quote_mark_email_sent(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/enterpriseQuote/mark-email-sent", params=params or {})
    def enterprise_quote_send_follow_up_reminder(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/enterpriseQuote/send-follow-up-reminder", json_data=params or {})
    def enterprise_quote_update_details(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/enterpriseQuote/update-details", json_data=params or {})
    def enterprise_quote_update_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/enterpriseQuote/update-status", json_data=params or {})

    # ═══ P6: externalApi (1 methods) ═══
    def external_api_audit_logs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/externalApi/audit-logs", params=params or {})

    # ═══ P6: externalGate (9 methods) ═══
    def external_gate_add_policy(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/externalGate/add-policy", json_data=params or {})
    def external_gate_audit_logs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/externalGate/audit-logs", params=params or {})
    def external_gate_batch_update_policies(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/externalGate/batch-update-policies", json_data=params or {})
    def external_gate_decisions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/externalGate/decisions", params=params or {})
    def external_gate_remove_policy(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/externalGate/remove-policy", json_data=params or {})
    def external_gate_reset_policies(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/externalGate/reset-policies", json_data=params or {})
    def external_gate_test_dual_gate(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/externalGate/test-dual-gate", json_data=params or {})
    def external_gate_test_gate_check(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/externalGate/test-gate-check", json_data=params or {})
    def external_gate_update_policy(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/externalGate/update-policy", json_data=params or {})

    # ═══ P6: gdpr (10 methods) ═══
    def gdpr_check_compliance_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/gdpr/check-compliance-status", params=params or {})
    def gdpr_create_dsr_request(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/gdpr/create-d-s-r-request", json_data=params or {})
    def gdpr_get_dsr_request(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/gdpr/get-d-s-r-request", params=params or {})
    def gdpr_get_dsr_requests_by_user(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/gdpr/get-d-s-r-requests-by-user", params=params or {})
    def gdpr_get_pending_dsr_requests(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/gdpr/get-pending-d-s-r-requests", params=params or {})
    def gdpr_get_user_consents(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/gdpr/get-user-consents", params=params or {})
    def gdpr_record_consent(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/gdpr/record-consent", json_data=params or {})
    def gdpr_update_dsr_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/gdpr/update-d-s-r-status", json_data=params or {})
    def gdpr_verify_identity(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/gdpr/verify-identity", params=params or {})
    def gdpr_withdraw_consent(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/gdpr/withdraw-consent", params=params or {})

    # ═══ P6: job (3 methods) ═══
    def job_get_stale_quotes(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/job/get-stale-quotes", params=params or {})
    def job_run_stale_quote_reminder(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/job/run-stale-quote-reminder", params=params or {})
    def job_trigger_stale_quote_reminder_by_key(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/job/trigger-stale-quote-reminder-by-key", json_data=params or {})

    # ═══ P6: liveChat (4 methods) ═══
    def live_chat_get_session_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/liveChat/get-session-history", params=params or {})
    def live_chat_get_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/liveChat/get-stats", params=params or {})
    def live_chat_list_sessions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/liveChat/list-sessions", params=params or {})
    def live_chat_send_message(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/liveChat/send-message", json_data=params or {})

    # ═══ P6: manusIntegration (6 methods) ═══
    def manus_integration_check_approval_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/manusIntegration/check-approval-status", params=params or {})
    def manus_integration_get_integration_guide(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/manusIntegration/get-integration-guide", params=params or {})
    def manus_integration_get_integration_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/manusIntegration/get-integration-status", params=params or {})
    def manus_integration_pre_execute_verify(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/manusIntegration/pre-execute-verify", params=params or {})
    def manus_integration_report_execution_result(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/manusIntegration/report-execution-result", params=params or {})
    def manus_integration_request_rollback(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/manusIntegration/request-rollback", params=params or {})

    # ═══ P6: marketing (19 methods) ═══
    def marketing_add_publish_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/marketing/add-publish-history", json_data=params or {})
    def marketing_cancel_scheduled_post(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/marketing/cancel-scheduled-post", json_data=params or {})
    def marketing_create_scheduled_post(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/marketing/create-scheduled-post", json_data=params or {})
    def marketing_get_active_logos(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/marketing/get-active-logos", params=params or {})
    def marketing_get_calendar_data(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/marketing/get-calendar-data", params=params or {})
    def marketing_get_events(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/marketing/get-events", params=params or {})
    def marketing_get_experiment_results(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/marketing/get-experiment-results", params=params or {})
    def marketing_get_platform_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/marketing/get-platform-stats", params=params or {})
    def marketing_get_platform_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/marketing/get-platform-status", params=params or {})
    def marketing_get_publish_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/marketing/get-publish-history", params=params or {})
    def marketing_get_scheduled_posts(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/marketing/get-scheduled-posts", params=params or {})
    def marketing_get_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/marketing/get-stats", params=params or {})
    def marketing_post_to_all(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/marketing/post-to-all", json_data=params or {})
    def marketing_post_to_linked_in(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/marketing/post-to-linked-in", json_data=params or {})
    def marketing_post_to_twitter(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/marketing/post-to-twitter", json_data=params or {})
    def marketing_reorder(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/marketing/reorder", params=params or {})
    def marketing_track(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/marketing/track", params=params or {})
    def marketing_update_engagement(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/marketing/update-engagement", json_data=params or {})
    def marketing_update_scheduled_post(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/marketing/update-scheduled-post", json_data=params or {})

    # ═══ P6: mcpInstance (5 methods) ═══
    def mcp_instance_remove(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/mcpInstance/remove", json_data=params or {})
    def mcp_instance_restart(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/mcpInstance/restart", params=params or {})
    def mcp_instance_revive(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/mcpInstance/revive", params=params or {})
    def mcp_instance_scan_and_restart(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/mcpInstance/scan-and-restart", params=params or {})
    def mcp_instance_toggle_auto_restart(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/mcpInstance/toggle-auto-restart", json_data=params or {})

    # ═══ P6: mcpStats (4 methods) ═══
    def mcp_stats_get_overview(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/mcpStats/get-overview", params=params or {})
    def mcp_stats_get_recent_logs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/mcpStats/get-recent-logs", params=params or {})
    def mcp_stats_get_trend(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/mcpStats/get-trend", params=params or {})
    def mcp_stats_log_usage(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/mcpStats/log-usage", params=params or {})

    # ═══ P6: p0 (6 methods) ═══
    def p0_get(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p0/get", params=params or {})
    def p0_get_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p0/get-config", params=params or {})
    def p0_get_plan(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p0/get-plan", params=params or {})
    def p0_get_values(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p0/get-values", params=params or {})
    def p0_list_alerts(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p0/list-alerts", params=params or {})
    def p0_update_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p0/update-status", json_data=params or {})

    # ═══ P6: p1p2 (3 methods) ═══
    def p1p2_clear_cache(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p1p2/clear-cache", json_data=params or {})
    def p1p2_create_bundle(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p1p2/create-bundle", json_data=params or {})
    def p1p2_get_bundle(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p1p2/get-bundle", params=params or {})

    # ═══ P6: p3 (12 methods) ═══
    def p3_create_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p3/create-config", json_data=params or {})
    def p3_create_slack_integration(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p3/create-slack-integration", json_data=params or {})
    def p3_get(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3/get", params=params or {})
    def p3_get_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3/get-stats", params=params or {})
    def p3_get_steps(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3/get-steps", params=params or {})
    def p3_list_alerts(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3/list-alerts", params=params or {})
    def p3_list_configs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3/list-configs", params=params or {})
    def p3_list_slack_integrations(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3/list-slack-integrations", params=params or {})
    def p3_resolve_alert(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p3/resolve-alert", json_data=params or {})
    def p3_retry_delivery(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p3/retry-delivery", json_data=params or {})
    def p3_send_test(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p3/send-test", json_data=params or {})
    def p3_test_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p3/test-config", json_data=params or {})

    # ═══ P6: p3Fusion (33 methods) ═══
    def p3_fusion_add_member(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p3Fusion/add-member", json_data=params or {})
    def p3_fusion_cancel_subscription(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p3Fusion/cancel-subscription", json_data=params or {})
    def p3_fusion_change_plan(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p3Fusion/change-plan", json_data=params or {})
    def p3_fusion_create_asset(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p3Fusion/create-asset", json_data=params or {})
    def p3_fusion_create_mitigation(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p3Fusion/create-mitigation", json_data=params or {})
    def p3_fusion_create_schedule(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p3Fusion/create-schedule", json_data=params or {})
    def p3_fusion_create_subscription(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p3Fusion/create-subscription", json_data=params or {})
    def p3_fusion_delete_schedule(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p3Fusion/delete-schedule", json_data=params or {})
    def p3_fusion_generate_report(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/generate-report", params=params or {})
    def p3_fusion_get_asset(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/get-asset", params=params or {})
    def p3_fusion_get_control(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/get-control", params=params or {})
    def p3_fusion_get_dashboard(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/get-dashboard", params=params or {})
    def p3_fusion_get_definition(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/get-definition", params=params or {})
    def p3_fusion_get_latest_score(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/get-latest-score", params=params or {})
    def p3_fusion_get_lineage(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/get-lineage", params=params or {})
    def p3_fusion_get_quotas(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/get-quotas", params=params or {})
    def p3_fusion_get_score_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/get-score-history", params=params or {})
    def p3_fusion_list_assessments(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/list-assessments", params=params or {})
    def p3_fusion_list_assets(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/list-assets", params=params or {})
    def p3_fusion_list_billings(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/list-billings", params=params or {})
    def p3_fusion_list_conflicts(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/list-conflicts", params=params or {})
    def p3_fusion_list_controls(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/list-controls", params=params or {})
    def p3_fusion_list_definitions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/list-definitions", params=params or {})
    def p3_fusion_list_events(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/list-events", params=params or {})
    def p3_fusion_list_executions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/list-executions", params=params or {})
    def p3_fusion_list_gaps(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/list-gaps", params=params or {})
    def p3_fusion_list_members(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/list-members", params=params or {})
    def p3_fusion_list_mitigations(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/list-mitigations", params=params or {})
    def p3_fusion_list_schedules(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/list-schedules", params=params or {})
    def p3_fusion_list_versions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/p3Fusion/list-versions", params=params or {})
    def p3_fusion_rollback_to_version(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p3Fusion/rollback-to-version", json_data=params or {})
    def p3_fusion_update_schedule(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p3Fusion/update-schedule", json_data=params or {})
    def p3_fusion_upgrade_plan(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/p3Fusion/upgrade-plan", json_data=params or {})

    # ═══ P6: referral (5 methods) ═══
    def referral_get_bonus_quota(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/referral/get-bonus-quota", params=params or {})
    def referral_get_my_referral_code(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/referral/get-my-referral-code", params=params or {})
    def referral_get_my_referral_rewards(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/referral/get-my-referral-rewards", params=params or {})
    def referral_get_public_referral_info(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/referral/get-public-referral-info", params=params or {})
    def referral_redeem_referral_code(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/referral/redeem-referral-code", json_data=params or {})

    # ═══ P6: rule (5 methods) ═══
    def rule_export_csv(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/rule/export-csv", json_data=params or {})
    def rule_import_csv(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/rule/import-csv", json_data=params or {})
    def rule_refresh_cache(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/rule/refresh-cache", json_data=params or {})
    def rule_rollback_to_version(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/rule/rollback-to-version", json_data=params or {})
    def rule_test_pattern(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/rule/test-pattern", json_data=params or {})

    # ═══ P6: stripe (61 methods) ═══
    def stripe_add_quota_pool_member(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/stripe/add-quota-pool-member", json_data=params or {})
    def stripe_calculate_auditor_account_cost(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/calculate-auditor-account-cost", params=params or {})
    def stripe_calculate_deployment_addons_cost(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/calculate-deployment-addons-cost", params=params or {})
    def stripe_calculate_enterprise_price(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/calculate-enterprise-price", params=params or {})
    def stripe_can_create_quota_pool(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/can-create-quota-pool", params=params or {})
    def stripe_check_deployment_addon_eligibility(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/check-deployment-addon-eligibility", params=params or {})
    def stripe_check_overage_allowance(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/check-overage-allowance", params=params or {})
    def stripe_check_quota_with_degrade(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/check-quota-with-degrade", params=params or {})
    def stripe_create_auditor_account(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/stripe/create-auditor-account", json_data=params or {})
    def stripe_create_deployment_addon_checkout(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/stripe/create-deployment-addon-checkout", json_data=params or {})
    def stripe_create_deployment_subscription(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/stripe/create-deployment-subscription", json_data=params or {})
    def stripe_create_enterprise_checkout(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/stripe/create-enterprise-checkout", json_data=params or {})
    def stripe_create_environment_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/stripe/create-environment-config", json_data=params or {})
    def stripe_create_portal_session(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/stripe/create-portal-session", json_data=params or {})
    def stripe_create_quota_pack_checkout(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/stripe/create-quota-pack-checkout", json_data=params or {})
    def stripe_create_quota_pool(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/stripe/create-quota-pool", json_data=params or {})
    def stripe_format_price(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/format-price", params=params or {})
    def stripe_get_auditor_account(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-auditor-account", params=params or {})
    def stripe_get_auditor_account_pricing(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-auditor-account-pricing", params=params or {})
    def stripe_get_auditor_account_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-auditor-account-stats", params=params or {})
    def stripe_get_billing_event_weights(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-billing-event-weights", params=params or {})
    def stripe_get_billing_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-billing-stats", params=params or {})
    def stripe_get_bonus_quota(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-bonus-quota", params=params or {})
    def stripe_get_daily_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-daily-stats", params=params or {})
    def stripe_get_degrade_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-degrade-config", params=params or {})
    def stripe_get_deployment_addon(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-deployment-addon", params=params or {})
    def stripe_get_deployment_addon_catalog(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-deployment-addon-catalog", params=params or {})
    def stripe_get_endpoint_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-endpoint-stats", params=params or {})
    def stripe_get_enterprise_pricing_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-enterprise-pricing-config", params=params or {})
    def stripe_get_env_billing_policies(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-env-billing-policies", params=params or {})
    def stripe_get_environment_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-environment-stats", params=params or {})
    def stripe_get_joined_quota_pools(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-joined-quota-pools", params=params or {})
    def stripe_get_overage_pricing(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-overage-pricing", params=params or {})
    def stripe_get_overage_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-overage-stats", params=params or {})
    def stripe_get_owned_quota_pools(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-owned-quota-pools", params=params or {})
    def stripe_get_payment_detail(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-payment-detail", params=params or {})
    def stripe_get_payments(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-payments", params=params or {})
    def stripe_get_plan_limits(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-plan-limits", params=params or {})
    def stripe_get_products(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-products", params=params or {})
    def stripe_get_quota_packs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-quota-packs", params=params or {})
    def stripe_get_quota_pool(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-quota-pool", params=params or {})
    def stripe_get_quota_pool_members(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-quota-pool-members", params=params or {})
    def stripe_get_quota_prediction(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-quota-prediction", params=params or {})
    def stripe_get_trust_bundle_balance(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-trust-bundle-balance", params=params or {})
    def stripe_get_trust_bundle_pricing(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-trust-bundle-pricing", params=params or {})
    def stripe_get_trust_bundle_products(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-trust-bundle-products", params=params or {})
    def stripe_get_usage_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-usage-history", params=params or {})
    def stripe_get_usage_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-usage-stats", params=params or {})
    def stripe_get_usage_trend(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/get-usage-trend", params=params or {})
    def stripe_identify_environment(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/identify-environment", params=params or {})
    def stripe_list_auditor_accounts(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/list-auditor-accounts", params=params or {})
    def stripe_list_deployment_addons(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/list-deployment-addons", params=params or {})
    def stripe_list_environment_configs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/list-environment-configs", params=params or {})
    def stripe_list_user_deployment_subscriptions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/stripe/list-user-deployment-subscriptions", params=params or {})
    def stripe_regenerate_auditor_token(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/stripe/regenerate-auditor-token", json_data=params or {})
    def stripe_revoke_auditor_account(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/stripe/revoke-auditor-account", json_data=params or {})
    def stripe_sync_deployment_addon_subscriptions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/stripe/sync-deployment-addon-subscriptions", json_data=params or {})
    def stripe_update_auditor_account(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/stripe/update-auditor-account", json_data=params or {})
    def stripe_update_degrade_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/stripe/update-degrade-config", json_data=params or {})
    def stripe_update_deployment_subscription_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/stripe/update-deployment-subscription-status", json_data=params or {})
    def stripe_update_environment_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/stripe/update-environment-config", json_data=params or {})

    # ═══ P6: trust (16 methods) ═══
    def trust_check_silent_mode_eligibility(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/trust/check-silent-mode-eligibility", params=params or {})
    def trust_get_anomaly_push_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/trust/get-anomaly-push-config", params=params or {})
    def trust_get_cost_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/trust/get-cost-stats", params=params or {})
    def trust_get_cost_stats_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/trust/get-cost-stats-history", params=params or {})
    def trust_get_current_score(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/trust/get-current-score", params=params or {})
    def trust_get_level_info(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/trust/get-level-info", params=params or {})
    def trust_get_push_logs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/trust/get-push-logs", params=params or {})
    def trust_get_score_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/trust/get-score-history", params=params or {})
    def trust_get_silent_mode_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/trust/get-silent-mode-config", params=params or {})
    def trust_get_silent_mode_logs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/trust/get-silent-mode-logs", params=params or {})
    def trust_refresh_cost_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/trust/refresh-cost-stats", json_data=params or {})
    def trust_refresh_score(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/trust/refresh-score", json_data=params or {})
    def trust_reset_silent_mode_count(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/trust/reset-silent-mode-count", json_data=params or {})
    def trust_test_push_channel(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/trust/test-push-channel", json_data=params or {})
    def trust_update_anomaly_push_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/trust/update-anomaly-push-config", json_data=params or {})
    def trust_update_silent_mode_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/trust/update-silent-mode-config", json_data=params or {})

    # ═══ P6: tryDemo (43 methods) ═══
    def demo_add_comment(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/add-comment", json_data=params or {})
    def demo_add_group_member(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/add-group-member", json_data=params or {})
    def demo_api_key_usage_trend(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/api-key-usage-trend", params=params or {})
    def demo_batch_delete(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/batch-delete", json_data=params or {})
    def demo_compare_results(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/compare-results", params=params or {})
    def demo_create_notification_group(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/create-notification-group", json_data=params or {})
    def demo_create_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/create-template", json_data=params or {})
    def demo_delete_comment(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/delete-comment", json_data=params or {})
    def demo_delete_notification_group(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/delete-notification-group", json_data=params or {})
    def demo_delete_playground_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/delete-playground-history", json_data=params or {})
    def demo_delete_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/delete-template", json_data=params or {})
    def demo_export_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/export-history", json_data=params or {})
    def demo_export_playground_json(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/export-playground-j-s-o-n", json_data=params or {})
    def demo_export_playground_pdf(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/export-playground-p-d-f", json_data=params or {})
    def demo_get_comments(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/get-comments", params=params or {})
    def demo_get_failure_pattern_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/get-failure-pattern-stats", params=params or {})
    def demo_get_group_members(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/get-group-members", params=params or {})
    def demo_get_hallucination_trends(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/get-hallucination-trends", params=params or {})
    def demo_get_my_check_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/get-my-check-history", params=params or {})
    def demo_get_my_templates(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/get-my-templates", params=params or {})
    def demo_get_notification_groups(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/get-notification-groups", params=params or {})
    def demo_get_notification_prefs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/get-notification-prefs", params=params or {})
    def demo_get_playground_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/get-playground-history", params=params or {})
    def demo_get_shared_result(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/get-shared-result", params=params or {})
    def demo_get_template_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/get-template-stats", params=params or {})
    def demo_get_template_versions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/get-template-versions", params=params or {})
    def demo_get_templates(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/get-templates", params=params or {})
    def demo_list_api_keys(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/list-api-keys", params=params or {})
    def demo_my_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/my-history", params=params or {})
    def demo_my_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/my-stats", params=params or {})
    def demo_my_trend(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/my-trend", params=params or {})
    def demo_playground_analyze(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/playground-analyze", params=params or {})
    def demo_remove_group_member(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/remove-group-member", json_data=params or {})
    def demo_rollback_template_version(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/rollback-template-version", json_data=params or {})
    def demo_save_playground_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/save-playground-history", json_data=params or {})
    def demo_save_template_version(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/save-template-version", json_data=params or {})
    def demo_team_history(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/team-history", params=params or {})
    def demo_team_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/tryDemo/team-stats", params=params or {})
    def demo_toggle_template_interaction(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/toggle-template-interaction", json_data=params or {})
    def demo_update_notification_group(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/update-notification-group", json_data=params or {})
    def demo_update_notification_prefs(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/update-notification-prefs", json_data=params or {})
    def demo_update_template(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/update-template", json_data=params or {})
    def demo_update_visibility(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/tryDemo/update-visibility", json_data=params or {})

    # ═══ P6: twitter (6 methods) ═══
    def twitter_get_marketing_events(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/twitter/get-marketing-events", params=params or {})
    def twitter_get_mentions(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/twitter/get-mentions", params=params or {})
    def twitter_get_scheduler_status(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/twitter/get-scheduler-status", params=params or {})
    def twitter_post_tweet(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/twitter/post-tweet", json_data=params or {})
    def twitter_publish_now(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/twitter/publish-now", json_data=params or {})
    def twitter_verify_credentials(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/twitter/verify-credentials", params=params or {})

    # ═══ P6: verification (11 methods) ═══
    def verify_demo_verify(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/verification/demo-verify", params=params or {})
    def verify_fact_verify(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/verification/fact-verify", params=params or {})
    def verify_get_api_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/verification/get-api-stats", params=params or {})
    def verify_get_api_time_series(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/verification/get-api-time-series", params=params or {})
    def verify_get_daily_stats(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/verification/get-daily-stats", params=params or {})
    def verify_get_hourly_heatmap(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/verification/get-hourly-heatmap", params=params or {})
    def verify_get_top_endpoints(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/verification/get-top-endpoints", params=params or {})
    def verify_get_webhook_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/verification/get-webhook-config", params=params or {})
    def verify_quick_verify(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/verification/quick-verify", params=params or {})
    def verify_run_pipeline(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("GET", "/p6/verification/run-pipeline", params=params or {})
    def verify_update_webhook_config(self, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
        return self._request("POST", "/p6/verification/update-webhook-config", json_data=params or {})

    def protect(
        self,
        action: str,
        resource: str,
        context: Optional[Dict[str, Any]] = None,
        actor_id: Optional[str] = None,
    ) -> "SOVRLifecycle":
        """
        Execute the full SOVR lifecycle for an action.

        Returns a SOVRLifecycle helper that guides you through:
        1. Gate check → 2. Request approval (if needed) → 3. Get permit →
        4. (execute action) → 5. Submit receipt

        Example:
            >>> lifecycle = sovr.protect(
            ...     action="send_payment",
            ...     resource="stripe/charge",
            ...     context={"amount": 5000},
            ... )
            >>> if not lifecycle.is_allowed:
            ...     raise Exception(f"Blocked: {lifecycle.decision.reason}")
            >>> permit = lifecycle.get_permit()
            >>> result = do_payment()
            >>> lifecycle.submit_receipt(
            ...     external_ref=result["id"],
            ...     status="success",
            ...     output_hash=hashlib.sha256(json.dumps(result).encode()).hexdigest(),
            ... )
        """
        decision = self.gate_check(action, resource, context, actor_id)
        return SOVRLifecycle(self, decision)

    # ====================================================================
    # Function Call Interceptor
    # ====================================================================

    def wrap(
        self,
        fn: Callable,
        action: str,
        resource: str,
        context: Optional[Dict[str, Any]] = None,
        actor_id: Optional[str] = None,
        on_blocked: str = "throw",
        on_approval: str = "throw",
    ) -> Callable:
        """
        Wrap a function with SOVR gate-check protection.

        This is the key integration point for Function Calling interception.

        Args:
            fn: The function to wrap
            action: Action name for gate-check
            resource: Resource identifier for gate-check
            context: Static context merged into every gate-check
            actor_id: Actor ID
            on_blocked: 'throw' (default) or 'return_none'
            on_approval: 'throw' (default)

        Returns:
            Wrapped function that goes through SOVR before execution.

        Example:
            >>> def send_payment(amount, to):
            ...     return stripe.charges.create(amount=amount, currency="usd")
            >>> safe_send = sovr.wrap(send_payment,
            ...     action="send_payment", resource="stripe/charge")
            >>> result = safe_send(5000, "acct_123")
        """
        client = self

        @wraps(fn)
        def wrapped(*args, **kwargs):
            # 1. Gate check
            decision = client.gate_check(
                action=action,
                resource=resource,
                context={**(context or {}), "function_args": args, "wrapped": True},
                actor_id=actor_id,
            )

            # 2. Handle deny
            if not decision.allowed:
                if on_blocked == "return_none":
                    return None
                raise ActionBlockedError(
                    f"Action blocked by SOVR policy: {decision.reason}",
                    decision_id=decision.decision_id,
                )

            # 3. Handle approval requirement
            if decision.requires_approval:
                raise ApprovalRequiredError(
                    f"Action requires human approval: {decision.reason}",
                    decision_id=decision.decision_id,
                )

            # 4. Get permit
            permit = client.grant_permit(decision_id=decision.decision_id)

            # 5. Execute
            started_at = int(time.time() * 1000)
            try:
                result = fn(*args, **kwargs)
            except Exception as err:
                # Submit failure receipt
                try:
                    client.submit_receipt(
                        decision_id=decision.decision_id,
                        permit_id=permit.permit_id,
                        external_ref=f"error:{type(err).__name__}",
                        status="failure",
                        started_at=started_at,
                        finished_at=int(time.time() * 1000),
                        output_hash=_simple_hash(str(err)),
                        error_code=type(err).__name__,
                        error_message=str(err),
                    )
                except Exception:
                    pass  # Don't mask original error
                raise

            # 6. Submit success receipt
            try:
                client.submit_receipt(
                    decision_id=decision.decision_id,
                    permit_id=permit.permit_id,
                    external_ref=_extract_ref(result),
                    status="success",
                    started_at=started_at,
                    finished_at=int(time.time() * 1000),
                    output_hash=_simple_hash(json.dumps(result, default=str)),
                )
            except Exception:
                pass  # Fire-and-forget

            return result

        return wrapped

    # ====================================================================
    # Webhook Verification
    # ====================================================================

    @staticmethod
    def verify_webhook_signature(
        payload: bytes,
        signature: str,
        secret: str,
    ) -> bool:
        """
        Verify Webhook signature.

        Args:
            payload: Raw request body bytes
            signature: X-SOVR-Signature header value
            secret: Webhook secret

        Returns:
            True if signature is valid
        """
        expected = hmac.new(
            secret.encode(),
            payload,
            hashlib.sha256,
        ).hexdigest()

        if signature.startswith("sha256="):
            signature = signature[7:]

        return hmac.compare_digest(expected, signature)


class SOVRLifecycle:
    """
    Guides you through the full SOVR lifecycle for a single action.
    Created by SOVRClient.protect().
    """

    def __init__(self, client: SOVRClient, decision: GateCheckResult):
        self.client = client
        self.decision = decision
        self._permit: Optional[PermitResult] = None
        self._started_at = int(time.time() * 1000)

    @property
    def is_allowed(self) -> bool:
        return self.decision.allowed

    @property
    def needs_approval(self) -> bool:
        return self.decision.requires_approval

    @property
    def decision_id(self) -> str:
        return self.decision.decision_id

    def request_approval(
        self, justification: str, urgency: str = "medium"
    ) -> ApprovalResult:
        return self.client.request_approval(
            decision_id=self.decision.decision_id,
            justification=justification,
            urgency=urgency,
        )

    def get_permit(self, ttl_seconds: Optional[int] = None) -> PermitResult:
        self._permit = self.client.grant_permit(
            decision_id=self.decision.decision_id,
            ttl_seconds=ttl_seconds,
        )
        return self._permit

    def submit_receipt(
        self,
        external_ref: str,
        status: str,
        output_hash: str,
        artifact_refs: Optional[List[str]] = None,
        idempotency_key: Optional[str] = None,
        error_code: Optional[str] = None,
        error_message: Optional[str] = None,
    ) -> ReceiptResult:
        if not self._permit:
            raise SOVRError(
                "No permit obtained. Call get_permit() before submit_receipt().",
                status_code=400,
                error_code="NO_PERMIT",
            )
        return self.client.submit_receipt(
            decision_id=self.decision.decision_id,
            permit_id=self._permit.permit_id,
            external_ref=external_ref,
            status=status,
            started_at=self._started_at,
            finished_at=int(time.time() * 1000),
            output_hash=output_hash,
            artifact_refs=artifact_refs,
            idempotency_key=idempotency_key,
            error_code=error_code,
            error_message=error_message,
        )


# ============================================================================
# Utility Functions
# ============================================================================

def _simple_hash(input_str: str) -> str:
    """Simple hash for output fingerprinting."""
    h = 0
    for ch in input_str:
        h = ((h << 5) - h + ord(ch)) & 0xFFFFFFFF
    return f"sh_{h:x}"


def _extract_ref(result: Any) -> str:
    """Extract a reference string from a function result."""
    if result is None:
        return "null"
    if isinstance(result, (str, int, float)):
        return str(result)[:100]
    if isinstance(result, dict):
        for key in ["id", "_id", "ref", "reference", "charge_id", "payment_id", "order_id", "transaction_id"]:
            if key in result:
                return str(result[key])
        return "object"
    return "unknown"

    def create_checkout(self, price_id: str, mode: str, success_url: str = None, cancel_url: str = None) -> dict:
        """Create a generic Stripe checkout session (main deduction entry point)"""
        payload = {"priceId": price_id, "mode": mode}
        if success_url:
            payload["successUrl"] = success_url
        if cancel_url:
            payload["cancelUrl"] = cancel_url
        return self._request("POST", "/stripe/create-checkout", json=payload)

    def cancel_deployment_addon_subscription(self, subscription_id: int, at_period_end: bool = True) -> dict:
        """Cancel a deployment addon subscription"""
        return self._request("POST", "/stripe/cancel-deployment-addon-subscription", json={
            "subscriptionId": subscription_id,
            "atPeriodEnd": at_period_end
        })


    # ─── 用户余额系统 ────────────────────────────────────────────

    def get_balance(self) -> dict:
        """获取当前用户余额"""
        return self._request("GET", "/stripe/get-balance")

    def get_top_up_amounts(self) -> list:
        """获取预设充值金额列表"""
        return self._request("GET", "/stripe/get-top-up-amounts")

    def create_top_up_checkout(self, amount_cents: int) -> dict:
        """创建余额充值 Checkout Session"""
        return self._request("POST", "/stripe/create-top-up-checkout", {"amountCents": amount_cents})

    def deduct_from_balance(self, amount: float, description: str, reference_id: str = None, reference_type: str = None) -> dict:
        """从余额扣款"""
        payload = {"amount": amount, "description": description}
        if reference_id: payload["referenceId"] = reference_id
        if reference_type: payload["referenceType"] = reference_type
        return self._request("POST", "/stripe/deduct-from-balance", payload)

    def freeze_balance(self, amount: float, description: str, reference_id: str = None) -> dict:
        """冻结余额"""
        payload = {"amount": amount, "description": description}
        if reference_id: payload["referenceId"] = reference_id
        return self._request("POST", "/stripe/freeze-balance", payload)

    def unfreeze_balance(self, amount: float, description: str, reference_id: str = None) -> dict:
        """解冻余额"""
        payload = {"amount": amount, "description": description}
        if reference_id: payload["referenceId"] = reference_id
        return self._request("POST", "/stripe/unfreeze-balance", payload)

    def refund_to_balance(self, amount: float, description: str, reference_id: str = None) -> dict:
        """退款到余额"""
        payload = {"amount": amount, "description": description}
        if reference_id: payload["referenceId"] = reference_id
        return self._request("POST", "/stripe/refund-to-balance", payload)

    def get_balance_transactions(self, limit: int = 20, offset: int = 0, tx_type: str = None, start_date: str = None, end_date: str = None) -> dict:
        """查询余额流水记录"""
        params = {"limit": limit, "offset": offset}
        if tx_type: params["type"] = tx_type
        if start_date: params["startDate"] = start_date
        if end_date: params["endDate"] = end_date
        return self._request("GET", "/stripe/get-balance-transactions", params=params)

    def get_balance_stats(self) -> dict:
        """获取余额统计"""
        return self._request("GET", "/stripe/get-balance-stats")

