const Component = require(`vn-print/core/component`);
const reportHeader = new Component('report-header');
const reportFooter = new Component('report-footer');
const reportBody = new Component('report-body');
const NotFoundError = require('vn-loopback/util/not-found-error');

module.exports = {
    components: {
        'report-body': reportBody.build(),
        'report-header': reportHeader.build(),
        'report-footer': reportFooter.build()
    },
    methods: {
        checkMainEntity: function(entity) {
            if (entity == null)
                throw new NotFoundError();
        },
        formatDate: function(date, format) {
            const filters = this.$options.filters;
            return filters.date(date, format);
        }
    },
};