import { Field } from "./Field.js"; import { ValidationError } from "../ValidationError.js"; export class EnumField extends Field { constructor(key, values) { super(key); this.values = values; } validate(value) { if (this.values.includes(value)) return true; throw new ValidationError(`Invalid value for field "${this.key}" - must be one of: ${this.values.join(", ")}`); } }