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







export class MyItem implements IMyItem {
    x!: number;

    [key: string]: any;

    constructor(data?: IMyItem) {
        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];
            }
            this.x = _data["x"] !== undefined ? _data["x"] : null as any;
        }
    }

    static fromJS(data: any): MyItem {
        data = typeof data === 'object' ? data : {};
        let result = new MyItem();
        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];
        }
        data["x"] = this.x !== undefined ? this.x : null as any;
        return data;
    }
}

export interface IMyItem {
    x: number;

    [key: string]: any;
}

export class Test implements ITest {
    resource!: { [key: string]: MyItem; };

    [key: string]: any;

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

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

    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 : {};
        for (var property in this) {
            if (this.hasOwnProperty(property))
                data[property] = this[property];
        }
        if (this.resource) {
            data["resource"] = {};
            for (let key in this.resource) {
                if (this.resource.hasOwnProperty(key))
                    (data["resource"] as any)[key] = this.resource[key] ? this.resource[key].toJSON() : null as any;
            }
        }
        return data;
    }
}

export interface ITest {
    resource: { [key: string]: MyItem; };

    [key: string]: any;
}