import WarpError from "../errors/WarpError.js";
/** Runtime-backed byte length for a content attachment. */
export default class ContentAttachmentSize {
    value;
    constructor(value) {
        this.value = requireSizeValue(value);
        Object.freeze(this);
    }
    /** Returns the byte length. */
    toNumber() {
        return this.value;
    }
    /** Compares two content sizes by runtime value. */
    equals(other) {
        if (!(other instanceof ContentAttachmentSize)) {
            return false;
        }
        return this.value === other.value;
    }
}
/** Validates a content attachment byte length. */
function requireSizeValue(value) {
    if (!Number.isInteger(value) || value < 0) {
        throw new WarpError('ContentAttachmentSize must be a non-negative integer', 'E_VALIDATION');
    }
    return value;
}
