class Invoice { constructor(row) { this.id = row.id; this.invoice_number = row.invoice_number; this.user_id = row.user_id; this.source_type = row.source_type; this.source_id = row.source_id; this.buyer_name = row.buyer_name; this.buyer_email = row.buyer_email; this.buyer_street = row.buyer_street; this.buyer_postal_code = row.buyer_postal_code; this.buyer_city = row.buyer_city; this.buyer_country = row.buyer_country; this.currency = row.currency; this.total_net = Number(row.total_net); this.total_tax = Number(row.total_tax); this.total_gross = Number(row.total_gross); this.vat_rate = row.vat_rate != null ? Number(row.vat_rate) : null; this.status = row.status; this.issued_at = row.issued_at; this.due_at = row.due_at; this.pdf_storage_key = row.pdf_storage_key; this.context = row.context ? (typeof row.context === 'string' ? JSON.parse(row.context) : row.context) : null; this.created_at = row.created_at; this.updated_at = row.updated_at; } } module.exports = Invoice;