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







export class Foo implements IFoo {
    prop!: { [key: string]: any; } | null;

    [key: string]: any;

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

    init(_data?: any) {
        if (_data) {
            for (var property in _data) {
                if (_data.hasOwnProperty(property))
                    this[property] = _data[property];
            }
            if (_data["Prop"]) {
                this.prop = {} as any;
                for (let key in _data["Prop"]) {
                    if (_data["Prop"].hasOwnProperty(key))
                        (this.prop as any)![key] = _data["Prop"][key] !== undefined ? _data["Prop"][key] : null as any;
                }
            }
            else {
                this.prop = null as any;
            }
        }
    }

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

    toJSON(data?: any) {
        data = typeof data === 'object' ? data : {};
        for (var property in this) {
            if (this.hasOwnProperty(property))
                data[property] = this[property];
        }
        if (this.prop) {
            data["Prop"] = {};
            for (let key in this.prop) {
                if (this.prop.hasOwnProperty(key))
                    (data["Prop"] as any)[key] = this.prop[key] !== undefined ? this.prop[key] : null as any;
            }
        }
        return data;
    }
}

export interface IFoo {
    prop: { [key: string]: any; } | null;

    [key: string]: any;
}