import WarpError from "../errors/WarpError.js";
const WITNESSED_PROOF_STRENGTH = 'witnessed';
const DIGEST_ONLY_PROOF_STRENGTH = 'digest-only';
const CLAIMED_PROOF_STRENGTH = 'claimed';
const NO_PROOF_STRENGTH = 'none';
export const CONTINUUM_EVIDENCE_PROOF_STRENGTHS = Object.freeze([
    WITNESSED_PROOF_STRENGTH,
    DIGEST_ONLY_PROOF_STRENGTH,
    CLAIMED_PROOF_STRENGTH,
    NO_PROOF_STRENGTH,
]);
/** Proof-strength coordinate for a Continuum evidence posture. */
export default class ContinuumEvidenceProofStrength {
    value;
    constructor(value) {
        this.value = requireContinuumEvidenceProofStrengthValue(value);
        Object.freeze(this);
    }
    static witnessed() {
        return new ContinuumEvidenceProofStrength(WITNESSED_PROOF_STRENGTH);
    }
    static digestOnly() {
        return new ContinuumEvidenceProofStrength(DIGEST_ONLY_PROOF_STRENGTH);
    }
    static claimed() {
        return new ContinuumEvidenceProofStrength(CLAIMED_PROOF_STRENGTH);
    }
    static none() {
        return new ContinuumEvidenceProofStrength(NO_PROOF_STRENGTH);
    }
    isWitnessed() {
        return this.value === WITNESSED_PROOF_STRENGTH;
    }
    hasNoProof() {
        return this.value === NO_PROOF_STRENGTH;
    }
    equals(other) {
        return this.value === other.value;
    }
    toString() {
        return this.value;
    }
}
export function requireContinuumEvidenceProofStrengthValue(value) {
    if (typeof value !== 'string') {
        throw new WarpError(`Continuum evidence proof strength must be one of: ${CONTINUUM_EVIDENCE_PROOF_STRENGTHS.join(', ')}`, 'E_VALIDATION');
    }
    const valid = CONTINUUM_EVIDENCE_PROOF_STRENGTHS.find((candidate) => candidate === value);
    if (valid === undefined) {
        throw new WarpError(`Continuum evidence proof strength must be one of: ${CONTINUUM_EVIDENCE_PROOF_STRENGTHS.join(', ')}`, 'E_VALIDATION');
    }
    return valid;
}
