. */ declare(strict_types=1); namespace FireflyIII\Helpers\Collection; use Carbon\Carbon; use FireflyIII\Models\Bill as BillModel; /** * Class BillLine. */ class BillLine { /** @var string The amount */ protected $amount; /** @var BillModel The bill. */ protected $bill; /** @var bool Is it hit this period */ protected $hit; /** @var string What was the max amount. */ protected $max; /** @var string What was the min amount. */ protected $min; /** @var Carbon Latest date that payment is expected. */ private $endOfPayDate; /** @var Carbon Date of last hit */ private $lastHitDate; /** @var Carbon Date of last payment */ private $payDate; /** @var int Journal */ private $transactionJournalId; /** * BillLine constructor. */ public function __construct() { $this->lastHitDate = new Carbon; } /** * Amount getter. * * @return string */ public function getAmount(): string { return $this->amount ?? '0'; } /** * Amount setter. * * @param string $amount */ public function setAmount(string $amount): void { $this->amount = $amount; } /** * Bill getter. * * @return BillModel */ public function getBill(): BillModel { return $this->bill; } /** * Bill setter. * * @param BillModel $bill */ public function setBill(BillModel $bill): void { $this->bill = $bill; } /** * End of pay date getter. * * @return Carbon */ public function getEndOfPayDate(): Carbon { return $this->endOfPayDate; } /** * End of pay date setter. * * @param Carbon $endOfPayDate */ public function setEndOfPayDate(Carbon $endOfPayDate): void { $this->endOfPayDate = $endOfPayDate; } /** * Last hit date getter. * * @return Carbon */ public function getLastHitDate(): Carbon { return $this->lastHitDate; } /** * Last hit date setter. * * @param Carbon $lastHitDate */ public function setLastHitDate(Carbon $lastHitDate): void { $this->lastHitDate = $lastHitDate; } /** * Max getter. * * @return string */ public function getMax(): string { return $this->max; } /** * Max setter. * * @param string $max */ public function setMax(string $max): void { $this->max = $max; } /** * Min getter. * * @return string */ public function getMin(): string { return $this->min; } /** * Min setter. * * @param string $min */ public function setMin(string $min): void { $this->min = $min; } /** * Pay date getter. * * @return Carbon */ public function getPayDate(): Carbon { return $this->payDate; } /** * Pay date setter. * * @param Carbon $payDate */ public function setPayDate(Carbon $payDate): void { $this->payDate = $payDate; } /** * Journal ID getter. * * @return int */ public function getTransactionJournalId(): int { return $this->transactionJournalId ?? 0; } /** * Journal ID setter. * * @param int $transactionJournalId */ public function setTransactionJournalId(int $transactionJournalId): void { $this->transactionJournalId = $transactionJournalId; } /** * Is active. * * @return bool */ public function isActive(): bool { return 1 === (int)$this->bill->active; } /** * Is hit. * * @return bool */ public function isHit(): bool { return $this->hit; } /** * Set is hit. * * @param bool $hit */ public function setHit(bool $hit): void { $this->hit = $hit; } }