import { randomUUID } from "node:crypto"; import { BaseNode } from "./BaseNode"; import { TObjectValues } from "../types"; import { AGE } from "../constants"; export type TCriteriaNode = Pick; export class CriteriaNode extends BaseNode { _name = 'Criteria'; id: string | null = randomUUID(); ages: TObjectValues[] = []; any: boolean | null = null; constructor(payload: Partial = {}) { super(); this.fill(payload); } toXmlElement() { return { _name: this._name, _attrs: { id: this.id, ...(this.any ? { any: "true" } : {}), }, _content: this.ages.length ? this.ages.map(AgeInUse => ({ AgeInUse })) : { AlwaysMet: '' } } } }