export class FormBase<T> {

    // Define base options
    identifier: string;
    key: string;
    type: string;
    required: boolean;
    placeholder: string;
    label: string;
    value: T;
    options: {key: string, value: string, selected: string, identifier: string}[] = [];
    validation: {type: string, value: any, errorMessage: string}[] = [];


    constructor(options: {
        identifier?: string,
        key?: string,
        type?: string,
        required?:boolean,
        placeholder?:string,
        label?:string,
        value?: T

    } = {}) {
        this.identifier = options.identifier || '';
        this.key = options.key || '';
        this.type = options.type || 'text';
        this.required = !!options.required; // !! : converts a non-boolean to a inverted boolean, then inverts it back
        this.placeholder = options.placeholder || '';
        this.label = options.label || '';
        this.value = options.value;
        this.options = options['options'] || [];
        this.validation = options['validation'] || [];
    }
}