﻿//----------------------
// <auto-generated>
// </auto-generated>
//----------------------







export class Test implements ITest {
    foo!: { [key: string]: string; } | undefined;

    constructor(data?: ITest) {
        if (data) {
            for (var property in data) {
                if (data.hasOwnProperty(property))
                    (this as any)[property] = (data as any)[property];
            }
        }
    }

    init(_data?: any) {
        if (_data) {
            if (_data["Foo"]) {
                this.foo = {} as any;
                for (let key in _data["Foo"]) {
                    if (_data["Foo"].hasOwnProperty(key))
                        (this.foo as any)![key] = _data["Foo"][key];
                }
            }
        }
    }

    static fromJS(data: any): Test {
        data = typeof data === 'object' ? data : {};
        let result = new Test();
        result.init(data);
        return result;
    }

    toJSON(data?: any) {
        data = typeof data === 'object' ? data : {};
        if (this.foo) {
            data["Foo"] = {};
            for (let key in this.foo) {
                if (this.foo.hasOwnProperty(key))
                    (data["Foo"] as any)[key] = (this.foo as any)[key];
            }
        }
        return data;
    }
}

export interface ITest {
    foo: { [key: string]: string; } | undefined;
}