import {TypedRecord, makeTypedFactory} from "typed-immutable-record"; import { FormDefinition, FormMetadata, Section, SectionMetadata, FormInput, DropdownOption } from './form.client.models' export interface FormDefinitionRecord extends TypedRecord, FormDefinition {} export interface FormMetadataRecord extends TypedRecord, FormMetadata {} export interface SectionRecord extends TypedRecord, Section {} export interface SectionMetadataRecord extends TypedRecord, SectionMetadata {} export interface FormInputRecord extends TypedRecord, FormInput {} export interface DropdownOptionRecord extends TypedRecord, DropdownOption {} export class ClientFactoryImpl { formMetadataRecord = makeTypedFactory({ formId: null, instanceId: null, title: null }); formDefinitionRecord = makeTypedFactory({ meta: this.formMetadataRecord(), sections: [] }); sectionMetadataRecord = makeTypedFactory({ title: null, sectionId: null, layout: 'simple' }); sectionRecord = makeTypedFactory({ meta: this.sectionMetadataRecord(), layout: [] }); formInputRecord = makeTypedFactory({ name: 'unknown', type: 'unknown', label: '', required: false, options: null }); dropdownOptionRecord = makeTypedFactory({ label: '', value: '' }); } export const ClientFactory = new ClientFactoryImpl();