const Component = require(`vn-print/core/component`);
const emailBody = new Component('email-body');
module.exports = {
    name: 'invoice',
    async serverPrefetch() {
        this.invoice = await this.fetchInvoice(this.reference);
    },
    methods: {
        fetchInvoice(reference) {
            return this.findOneFromDef('invoice', [reference]);
        },
    },
    components: {
        'email-body': emailBody.build(),
    },
    props: {
        reference: {
            type: String,
            required: true
        }
    }
};