<commit_before>package backend.model.payment

import backend.exceptions.DomainException
import backend.model.BasicEntity
import org.javamoney.moneta.Money
import javax.persistence.MappedSuperclass
import javax.persistence.OneToMany

@MappedSuperclass
abstract class Invoice: BasicEntity {

    @OneToMany
    private val payments: MutableList<Payment> = mutableListOf()

    var amount: Money
        private set

    constructor(amount: Money) {
        this.amount = amount
    }

    fun addPayment(payment: Payment) {
        if (isPaymentEligable(payment)) {
            this.payments.add(payment)
        } else throw DomainException("Payment $payment is not eligable for invoice $this")
    }

    fun isFullyPaid(): Boolean {
        return this.amountOfCurrentPayments().isGreaterThanOrEqualTo(this.amount)
    }<commit_msg>Mark amount: Money as @Column in Invoice<commit_after>package backend.model.payment

import backend.exceptions.DomainException
import backend.model.BasicEntity
import org.javamoney.moneta.Money
import javax.persistence.Column
import javax.persistence.MappedSuperclass
import javax.persistence.OneToMany

@MappedSuperclass
abstract class Invoice: BasicEntity {

    @OneToMany
    private val payments: MutableList<Payment> = mutableListOf()

    @Column
    var amount: Money
        private set

    constructor(amount: Money) {
        this.amount = amount
    }

    fun addPayment(payment: Payment) {
        if (isPaymentEligable(payment)) {
            this.payments.add(payment)
        } else throw DomainException("Payment $payment is not eligable for invoice $this")
    }

    fun isFullyPaid(): Boolean {
        return this.amountOfCurrentPayments().isGreaterThanOrEqualTo(this.amount)
    }
{'fraction_non_alphanumeric': 0.0800230282095567, 'fraction_numerical': 0.0, 'mean_word_length': 3.6972972972972973, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4883986', 'n_tokens_mistral': 491, 'n_tokens_neox': 475, 'n_words': 115}