"""Local trust specifications used by the scanner."""

from __future__ import annotations

from .trust_models import TrustAdapterSpec, TrustSpecDefinition

SKILL_TRUST_SPEC = TrustSpecDefinition(
    spec_id="HCS-28",
    version="0.1",
    label="Skill Trust",
    spec_path="docs/trust/skill-trust-local.md",
    derived_from=("HCS-26", "HCS-28"),
    profile_id="hcs-28/baseline",
    profile_version="0.1",
    adapters=(
        TrustAdapterSpec(
            adapter_id="verification.review-status",
            label="Review Status",
            weight=0.50,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="verification.publisher-bound",
            label="Publisher Bound",
            weight=0.20,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="verification.repo-commit-integrity",
            label="Repo Commit Integrity",
            weight=0.40,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="verification.manifest-integrity",
            label="Manifest Integrity",
            weight=0.30,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="verification.domain-proof",
            label="Domain Proof",
            weight=0.10,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="metadata.links",
            label="Metadata Links",
            weight=0.30,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="metadata.description",
            label="Metadata Description",
            weight=0.25,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="metadata.taxonomy",
            label="Metadata Taxonomy",
            weight=0.20,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="metadata.provenance",
            label="Metadata Provenance",
            weight=0.25,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="upvotes",
            label="Upvotes",
            weight=1.0,
            component_keys=("score",),
            contribution_mode="conditional",
        ),
        TrustAdapterSpec(
            adapter_id="safety.cisco-scan",
            label="Cisco Safety Scan",
            weight=1.0,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="repository.health",
            label="Repository Health",
            weight=1.0,
            component_keys=("score",),
            contribution_mode="conditional",
        ),
    ),
)

MCP_TRUST_SPEC = TrustSpecDefinition(
    spec_id="HOL-HCS-MCP-TRUST-DRAFT",
    version="0.1.0",
    label="MCP Server Trust",
    spec_path="docs/trust/mcp-trust-draft.md",
    derived_from=("HCS-26", "HCS-28"),
    profile_id="hol-hcs-mcp-trust/baseline",
    profile_version="0.1",
    adapters=(
        TrustAdapterSpec(
            adapter_id="verification.config-integrity",
            label="Config Integrity",
            weight=0.40,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="verification.execution-safety",
            label="Execution Safety",
            weight=0.35,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="verification.transport-security",
            label="Transport Security",
            weight=0.25,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="metadata.server-naming",
            label="Server Naming",
            weight=0.1875,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="metadata.command-or-endpoint",
            label="Command Or Endpoint",
            weight=0.3375,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="metadata.config-shape",
            label="Config Shape",
            weight=0.225,
            component_keys=("score",),
            contribution_mode="universal",
        ),
    ),
)

PLUGIN_TRUST_SPEC = TrustSpecDefinition(
    spec_id="HOL-HCS-CODEX-PLUGIN-TRUST-DRAFT",
    version="0.1.0",
    label="Codex Plugin Trust",
    spec_path="docs/trust/plugin-trust-draft.md",
    derived_from=("HCS-26", "HCS-28"),
    profile_id="hol-codex-plugin-trust/baseline",
    profile_version="0.1",
    adapters=(
        TrustAdapterSpec(
            adapter_id="verification.manifest-integrity",
            label="Manifest Integrity",
            weight=0.35,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="verification.interface-integrity",
            label="Interface Integrity",
            weight=0.25,
            component_keys=("score",),
            contribution_mode="conditional",
        ),
        TrustAdapterSpec(
            adapter_id="verification.path-safety",
            label="Path Safety",
            weight=0.20,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="verification.marketplace-alignment",
            label="Marketplace Alignment",
            weight=0.20,
            component_keys=("score",),
            contribution_mode="conditional",
        ),
        TrustAdapterSpec(
            adapter_id="security.disclosure",
            label="Disclosure",
            weight=0.15,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="security.license",
            label="License",
            weight=0.10,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="security.secret-hygiene",
            label="Secret Hygiene",
            weight=0.35,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="security.mcp-safety",
            label="MCP Safety",
            weight=0.20,
            component_keys=("score",),
            contribution_mode="conditional",
        ),
        TrustAdapterSpec(
            adapter_id="security.approval-hygiene",
            label="Approval Hygiene",
            weight=0.20,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="metadata.documentation",
            label="Documentation",
            weight=0.15,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="metadata.manifest-metadata",
            label="Manifest Metadata",
            weight=0.2625,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="metadata.discoverability",
            label="Discoverability",
            weight=0.15,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="metadata.provenance",
            label="Provenance",
            weight=0.1875,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="operations.action-pinning",
            label="Action Pinning",
            weight=0.2625,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="operations.permission-scope",
            label="Permission Scope",
            weight=0.15,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="operations.untrusted-checkout",
            label="Untrusted Checkout",
            weight=0.1875,
            component_keys=("score",),
            contribution_mode="universal",
        ),
        TrustAdapterSpec(
            adapter_id="operations.update-automation",
            label="Update Automation",
            weight=0.15,
            component_keys=("score",),
            contribution_mode="universal",
        ),
    ),
)
