*/ protected function casts(): array { return ['cancelled_on' => 'immutable_date', 'has_policy' => 'boolean', 'settled_at' => 'immutable_datetime']; } /** * @return BelongsTo */ public function booking(): BelongsTo { return $this->belongsTo(Booking::class); } /** * What the guest owes: the final fee, else the proposal; nothing when waived. */ public function fee(): int { return $this->status === self::WAIVED ? 0 : (int) ($this->final_fee ?? $this->calculated_fee ?? 0); } /** * Positive: the guest still has to pay; negative: the landlord has to refund. */ public function balance(): int { return $this->fee() - $this->paid_amount; } }