import type { EnumLike, EnumValue } from '@rsdk/common'; import { Convert, Enum, text } from '@rsdk/common'; import type { PropertyParser } from '../../types'; export class EnumParser implements PropertyParser { constructor(private readonly enumeration: EnumLike) {} type(): string { return `string|number(enum_value)`; } description(): string { return text` Extracts strings or numbers and ensures it is one of: ${Enum.values(this.enumeration).join(', ')} `; } parse(value: unknown): E { return Convert.enum(value, this.enumeration); } }