import { Input } from "./Input"; export enum InputSetMethod { Direct = 'direct', Message = 'message' } export enum InputSetType { Normal = 'normal', InputKeyboard = 'input_keyboard' } export class InputSet { //Required private id: string; private input: Input[]; //Optional private type: InputSetType = InputSetType.Normal; private method: InputSetMethod = InputSetMethod.Direct; private regex: string = ''; constructor(id: string, input: Input[]) { this.id = id; this.input = input; } findInput(name: string): Input { for (let inp of this.input) { if (inp.Name == name) return inp } return null; } setType(type: InputSetType): InputSet { this.type = type; return this; } setMethod(method: InputSetMethod): InputSet { this.method = method; return this; } setRegex(regex: string): InputSet { this.regex = regex; return this; } get Type(): InputSetType { return this.type; } get Id(): string { return this.id; } get Input(): Input[] { return this.input; } get Method(): InputSetMethod { return this.method; } get Regex(): string { return this.regex; } toJSON(): any { return { type: this.type, id: this.id, method: this.method, regex: this.regex, input: this.input.map((input: Input) => input.toJSON()) } } }