import { PNumberInput, PCombobox } from '@prefecthq/prefect-design' import { SchemaPropertyService } from '@/services/schemas/properties/SchemaPropertyService' import { SchemaPropertyComponentWithProps } from '@/services/schemas/utilities' import { SchemaValue } from '@/types/schemas' export class SchemaPropertyInteger extends SchemaPropertyService { protected get default(): unknown { return this.property.default ?? null } protected override get component(): SchemaPropertyComponentWithProps { if (this.has('enum')) { return this.withProps(PCombobox, { options: this.getSelectOptions(), }) } return this.withProps(PNumberInput) } protected request(value: SchemaValue): unknown { return value } protected response(value: SchemaValue): unknown { const result = parseInt(value as string) if (isNaN(result)) { return this.invalid() } return result } }