export default class ErrorModel {
    constructor(data) {
        this.m_message = data.message;
        this.m_code = data.code;
        this.m_key = data.key;
        this.m_tags = data.tags;
        this.parseKey();
    }
    get code() {
        return this.m_code;
    }
    get featureIndex() {
        return this.m_featureIndex;
    }
    get groupIndex() {
        return this.m_groupIndex;
    }
    get key() {
        return this.m_key;
    }
    get message() {
        return this.m_message;
    }
    get propertyName() {
        return this.m_propertyName;
    }
    get tags() {
        return this.m_tags;
    }
    toJSON() {
        return {
            code: this.code,
            key: this.key,
            message: this.message,
            tags: this.tags
        };
    }
    parseKey() {
        let parts = this.key.split(".");
        this.m_groupIndex = parseInt(parts[1].replace("Groups[", "").replace("]", ""));
        this.m_featureIndex = parseInt(parts[2].replace("Features[", "").replace("]", ""));
        this.m_propertyName = parts[3];
    }
}
