"use strict";
/*
 *
 * Copyright 2018-present NEM
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.StatementsView = void 0;
const formatter_service_1 = require("../../services/formatter.service");
const table_builder_1 = require("../table.builder");
const resolutionStatements_view_1 = require("./resolutionStatements.view");
const transactionStatements_view_1 = require("./transactionStatements.view");
class StatementsView {
    constructor(statement) {
        this.statement = statement;
    }
    /**
     * Logs the table
     */
    print() {
        Object.entries(this.tableEntries).forEach(([tableName, entries]) => {
            if (!entries) {
                return;
            }
            console.log(formatter_service_1.FormatterService.title(tableName));
            entries.forEach((entry) => console.log(`${table_builder_1.TableBuilder.renderTableFromArray(entry)} \n\n`));
        });
    }
    /**
     * The whole CellRecord to render in a table, without empty values
     * @readonly
     * @protected
     * @type {CellRecord}
     */
    get tableEntries() {
        return {
            'Transaction statements': new transactionStatements_view_1.TransactionStatementViews(this.statement.transactionStatements).render(),
            'Address resolution statements': new resolutionStatements_view_1.ResolutionStatementViews(this.statement.addressResolutionStatements).render(),
            'Mosaic resolution statements': new resolutionStatements_view_1.ResolutionStatementViews(this.statement.mosaicResolutionStatements).render(),
        };
    }
}
exports.StatementsView = StatementsView;
