import { autoserializeAs, Command, deserialize, inheritSerialization, serializable, serialize, Validators } from '@my-devkit/core'; import { CreateEnumerationPropertyCommand } from './create-enumeration-property-command'; import { DeleteEnumerationPropertyCommand } from './delete-enumeration-property-command'; import { RevertEnumerationPropertyChangeCommand } from './revert-enumeration-property-change-command'; type CommandType = CreateEnumerationPropertyCommand | DeleteEnumerationPropertyCommand | RevertEnumerationPropertyChangeCommand; @serializable @inheritSerialization(Command) export class UpdateEnumerationChangeCommand extends Command { @Validators.IsNotEmpty() @Validators.IsString() @autoserializeAs(String) public enumerationChangeId: string = null; @Validators.IsOptional() @Validators.IsString() @autoserializeAs(String) public description: string = null; @Validators.IsArray() public commands: CommandType[] = []; constructor() { super('UpdateEnumerationChangeCommand'); } public static OnDeserialized(instance: UpdateEnumerationChangeCommand, json: Record): void { if (json.commands) { instance.commands = json.commands.map((c: any) => deserialize(c)); } } public static OnSerialized(instance: UpdateEnumerationChangeCommand, json: Record): void { if (instance.commands) { json.commands = instance.commands.map((c) => serialize(c)); } } }