// Copyright 2024-2026 Tymofii Pidlisnyi. Apache-2.0 license. See LICENSE.
// ══════════════════════════════════════════════════════════════════
// Claim → Evidence types (skeleton)
// ══════════════════════════════════════════════════════════════════
// Names a closed set of claims an APS receipt can substantiate, the
// record types the protocol can produce, and the mapping between
// them. Receipts substantiate specific claims; not every receipt
// can substitute for another. This module is the static surface of
// that mapping. Verification logic lives elsewhere.
// ══════════════════════════════════════════════════════════════════
export var ClaimType;
(function (ClaimType) {
    ClaimType["IDENTITY_VERIFIED"] = "IDENTITY_VERIFIED";
    ClaimType["AUTHORITY_TO_EXECUTE"] = "AUTHORITY_TO_EXECUTE";
    ClaimType["ACTION_EXECUTED"] = "ACTION_EXECUTED";
    ClaimType["BINDING_COMMITMENT"] = "BINDING_COMMITMENT";
    ClaimType["EFFECT_SAFETY_ATTESTED"] = "EFFECT_SAFETY_ATTESTED";
    ClaimType["DERIVATION_TRACED"] = "DERIVATION_TRACED";
    ClaimType["CLAIM_CONTESTED"] = "CLAIM_CONTESTED";
    ClaimType["CLAIM_RESOLVED"] = "CLAIM_RESOLVED";
    ClaimType["BATCH_ATTESTED"] = "BATCH_ATTESTED";
    ClaimType["EVIDENCE_CUSTODY_HELD"] = "EVIDENCE_CUSTODY_HELD";
})(ClaimType || (ClaimType = {}));
/**
 * Mirrors the existing record-producing primitives the SDK ships.
 * Names match the TypeScript interfaces / class shapes already in
 * the public surface (see src/index.ts). When new primitives are
 * added, extend this enum and update EvidenceProfiles accordingly.
 */
export var RecordType;
(function (RecordType) {
    RecordType["ActionReceipt"] = "ActionReceipt";
    RecordType["AuthorityBoundaryReceipt"] = "AuthorityBoundaryReceipt";
    RecordType["CustodyReceipt"] = "CustodyReceipt";
    RecordType["ContestabilityReceipt"] = "ContestabilityReceipt";
    RecordType["APSBundle"] = "APSBundle";
    RecordType["AccessReceipt"] = "AccessReceipt";
    RecordType["DerivationReceipt"] = "DerivationReceipt";
    RecordType["DecisionReceipt"] = "DecisionReceipt";
    RecordType["ProvisionalStatement"] = "ProvisionalStatement";
    RecordType["PromotionEvent"] = "PromotionEvent";
    RecordType["Withdrawal"] = "Withdrawal";
    RecordType["InstructionProvenanceReceipt"] = "InstructionProvenanceReceipt";
    RecordType["CognitiveAttestation"] = "CognitiveAttestation";
    /** Foundation rail receipt — proof of rail event, NOT economic entitlement.
     *  See docs/governance/payment-rails-receipt-semantics.md. */
    RecordType["PaymentReceipt"] = "PaymentReceipt";
    /** ACP rail receipt — proof an ACP checkout-session op was authorized. */
    RecordType["AcpReceipt"] = "AcpReceipt";
    /** MPP rail receipt — proof an MPP 402 challenge was satisfied. */
    RecordType["MppApsReceipt"] = "MppApsReceipt";
    /** AP2 mandate — proof a mandate was issued, NOT proof of payment. */
    RecordType["SignedAP2Mandate"] = "SignedAP2Mandate";
    /** Stripe-Issuing receipt — proof the rail's webhook gate approved a card auth. */
    RecordType["StripeIssuingReceipt"] = "StripeIssuingReceipt";
})(RecordType || (RecordType = {}));
/**
 * Canonical claim_type literal for each rail receipt's evidence-class binding.
 * The same string is set on the rail receipt's `claim_type` field at signing
 * time when the new accountability-aligned signing path is used. Legacy
 * receipts (without these literals) continue to verify under the existing
 * per-rail verifier path.
 */
export const RAIL_RECEIPT_CLAIM_TYPES = {
    [RecordType.PaymentReceipt]: 'rail.payment.v1',
    [RecordType.AcpReceipt]: 'rail.acp.v1',
    [RecordType.MppApsReceipt]: 'rail.mpp.v1',
    [RecordType.SignedAP2Mandate]: 'rail.ap2.mandate.v1',
    [RecordType.StripeIssuingReceipt]: 'rail.stripe_issuing.v1',
};
export const EvidenceProfiles = {
    [ClaimType.AUTHORITY_TO_EXECUTE]: {
        required: [RecordType.AuthorityBoundaryReceipt],
        optional: [RecordType.DecisionReceipt],
        forbiddenSubstitutions: {
            [RecordType.ActionReceipt]: 'Action receipts prove execution, not authority. The boundary ruling is a separate signer (the gateway/evaluator), and conflating them collapses the trust split that makes the audit chain meaningful.',
        },
    },
    [ClaimType.BINDING_COMMITMENT]: {
        required: [RecordType.PromotionEvent, RecordType.ProvisionalStatement],
        optional: [RecordType.DecisionReceipt],
        forbiddenSubstitutions: {
            [RecordType.ActionReceipt]: 'Action receipts prove execution or communication, not binding commitment.',
        },
    },
    // TODO: populate required/optional records and forbiddenSubstitutions.
    [ClaimType.IDENTITY_VERIFIED]: {
        required: [],
        forbiddenSubstitutions: {},
    },
    // TODO: populate required/optional records and forbiddenSubstitutions.
    [ClaimType.ACTION_EXECUTED]: {
        required: [],
        forbiddenSubstitutions: {},
    },
    // TODO: populate required/optional records and forbiddenSubstitutions.
    [ClaimType.EFFECT_SAFETY_ATTESTED]: {
        required: [],
        forbiddenSubstitutions: {},
    },
    // TODO: populate required/optional records and forbiddenSubstitutions.
    [ClaimType.DERIVATION_TRACED]: {
        required: [],
        forbiddenSubstitutions: {},
    },
    // TODO: populate required/optional records and forbiddenSubstitutions.
    [ClaimType.CLAIM_CONTESTED]: {
        required: [],
        forbiddenSubstitutions: {},
    },
    // TODO: populate required/optional records and forbiddenSubstitutions.
    [ClaimType.CLAIM_RESOLVED]: {
        required: [],
        forbiddenSubstitutions: {},
    },
    [ClaimType.BATCH_ATTESTED]: {
        required: [RecordType.APSBundle],
        forbiddenSubstitutions: {},
    },
    [ClaimType.EVIDENCE_CUSTODY_HELD]: {
        required: [RecordType.CustodyReceipt],
        forbiddenSubstitutions: {
            [RecordType.ActionReceipt]: 'Action receipts prove what was done, not who held the evidence afterward.',
        },
    },
};
export function requiredEvidenceFor(claim) {
    return EvidenceProfiles[claim];
}
//# sourceMappingURL=claim-evidence-types.js.map