import WarpError from "../errors/WarpError.js";
const COMPLETE_COMPLETENESS = 'complete';
const PARTIAL_COMPLETENESS = 'partial';
const RESIDUAL_COMPLETENESS = 'residual';
const OBSTRUCTED_COMPLETENESS = 'obstructed';
const UNSUPPORTED_COMPLETENESS = 'unsupported';
export const CONTINUUM_EVIDENCE_COMPLETENESSES = Object.freeze([
    COMPLETE_COMPLETENESS,
    PARTIAL_COMPLETENESS,
    RESIDUAL_COMPLETENESS,
    OBSTRUCTED_COMPLETENESS,
    UNSUPPORTED_COMPLETENESS,
]);
/** Completeness coordinate for a Continuum evidence posture. */
export default class ContinuumEvidenceCompleteness {
    value;
    constructor(value) {
        this.value = requireContinuumEvidenceCompletenessValue(value);
        Object.freeze(this);
    }
    static complete() {
        return new ContinuumEvidenceCompleteness(COMPLETE_COMPLETENESS);
    }
    static partial() {
        return new ContinuumEvidenceCompleteness(PARTIAL_COMPLETENESS);
    }
    static residual() {
        return new ContinuumEvidenceCompleteness(RESIDUAL_COMPLETENESS);
    }
    static obstructed() {
        return new ContinuumEvidenceCompleteness(OBSTRUCTED_COMPLETENESS);
    }
    static unsupported() {
        return new ContinuumEvidenceCompleteness(UNSUPPORTED_COMPLETENESS);
    }
    isComplete() {
        return this.value === COMPLETE_COMPLETENESS;
    }
    isUnsupported() {
        return this.value === UNSUPPORTED_COMPLETENESS;
    }
    equals(other) {
        return this.value === other.value;
    }
    toString() {
        return this.value;
    }
}
export function requireContinuumEvidenceCompletenessValue(value) {
    if (typeof value !== 'string') {
        throw new WarpError(`Continuum evidence completeness must be one of: ${CONTINUUM_EVIDENCE_COMPLETENESSES.join(', ')}`, 'E_VALIDATION');
    }
    const valid = CONTINUUM_EVIDENCE_COMPLETENESSES.find((candidate) => candidate === value);
    if (valid === undefined) {
        throw new WarpError(`Continuum evidence completeness must be one of: ${CONTINUUM_EVIDENCE_COMPLETENESSES.join(', ')}`, 'E_VALIDATION');
    }
    return valid;
}
