import { DataUtilities } from "../DataUtilities";
export class BaseTestResultItem {
    constructor(itemId, result = undefined) {
        this.when = new Date();
        this.isError = false;
        // we might need to break this up and store separate.
        this.items = [];
        this.itemId = itemId;
        this.result = result;
    }
    getParent() {
        throw new Error('not yet');
    }
    getItemsForId(id, type) {
        // this should get any items that are detail items.
        // guess we need to identify which items are detail items and which are not.
        throw new Error('bad bad bad');
    }
}
export class BaseTestResultData extends BaseTestResultItem {
    constructor() {
        super(...arguments);
        this.isShowResult = true;
        // we might need to break this up and store separate.
        this.items = [];
        this.logs = [];
        this.getTabs = null;
    }
    addTestResultItem(item) {
        this.items.push(item);
    }
    addLogItem(item) {
        this.logs.push(item);
    }
    addLogItems(items) {
        this.logs.push(...items);
    }
    getDuration() {
        if (this.logs.length === 0)
            return "";
        return DataUtilities.getElapsedTime(this.logs[0].when, this.logs[this.logs.length - 1].when);
    }
    findItem(itemId) {
        if (itemId === this.itemId)
            return this;
        for (let item of this.items) {
            if (item.itemId === itemId)
                return item;
            if (item instanceof BaseTestResultData) {
                let subitem = item.findItem(itemId);
                if (subitem)
                    return subitem;
            }
        }
    }
    render() {
        return undefined;
    }
}
// not sure if it's needed.
export class TestResultData {
    constructor() {
        // we might need to break this up and store separate.
        this.items = [];
        this.logs = [];
    }
    addTestResultItem(item) {
        this.items.push(item);
    }
    addLogItem(item) {
        this.logs.push(item);
    }
    addLogItems(items) {
        this.logs.push(...items);
    }
}
//# sourceMappingURL=TestResultData.js.map