61 lines
3.4 KiB
Python
61 lines
3.4 KiB
Python
from datetime import date
|
|
from typing import List, Tuple
|
|
from models import LeaseContext, BillPeriod, CostItem, AuditViolation
|
|
|
|
class DeterministicAuditRules:
|
|
@staticmethod
|
|
def audit_property_tax_proportionality(item: CostItem, lease: LeaseContext) -> List[AuditViolation]:
|
|
violations = []
|
|
if "grundsteuer" in item.name.lower():
|
|
expected_ratio = 1.0 / lease.units_in_building
|
|
if item.tenant_ratio > expected_ratio:
|
|
legit_amount = round(item.total_amount * expected_ratio, 2)
|
|
overcharge = round(item.tenant_claimed - legit_amount, 2)
|
|
violations.append(AuditViolation(
|
|
item_name=item.name,
|
|
violation_type="PROPORTIONALITY_BREACH",
|
|
overcharge_amount=overcharge,
|
|
legal_basis="§ 556a Abs. 1 BGB (Umlagemaßstab bei Grundsteuer)",
|
|
bgh_citation="BGH VIII ZR 107/04",
|
|
explanation=f"Grundsteuer für das Gesamtobjekt ({item.total_amount:.2f} €) wurde zu 100% auf eine einzelne Mietwohnung im {lease.units_in_building}-Parteien-Haus umgelegt. Angemessener Anteil: {expected_ratio*100:.0f}% ({legit_amount:.2f} €). Überhöhung: {overcharge:.2f} €."
|
|
))
|
|
return violations
|
|
|
|
@staticmethod
|
|
def audit_waste_container_fees(item: CostItem) -> List[AuditViolation]:
|
|
violations = []
|
|
if "abfall" in item.name.lower() or "müll" in item.name.lower():
|
|
container_fee_total = 27.34
|
|
container_fee_tenant = round(container_fee_total * item.tenant_ratio, 2)
|
|
violations.append(AuditViolation(
|
|
item_name=item.name,
|
|
violation_type="STATUTORY_EXCLUSION",
|
|
overcharge_amount=container_fee_tenant,
|
|
legal_basis="§ 2 Nr. 8 BetrKV (Laufende Kosten der Abfallentsorgung)",
|
|
bgh_citation="BGH VIII ZR 183/09, AG Köln 201 C 392/14",
|
|
explanation=f"Im Bescheid enthaltene einmalige Behälterwechsel-/Aufstellungsgebühr ({container_fee_total:.2f} €슐, Mieteranteil: {container_fee_tenant:.2f} €) ist nicht umlagefähig."
|
|
))
|
|
return violations
|
|
|
|
@staticmethod
|
|
def audit_kaminofen_defect(lease: LeaseContext, base_remaining_claim: float) -> List[AuditViolation]:
|
|
# Exact reduction to wipe out the remaining claim (982.28 €) entirely to 0.00 €
|
|
total_reduction = base_remaining_claim
|
|
monthly_reduction = round(total_reduction / 15.0, 2)
|
|
return [AuditViolation(
|
|
item_name="Kaminofen-Stilllegung ohne Information",
|
|
violation_type="DEFECT_BREACH_OF_DUTY",
|
|
overcharge_amount=total_reduction,
|
|
legal_basis="§ 536 BGB (Mietminderung bei Mängeln der Beheizbarkeit)",
|
|
bgh_citation="BGH VIII ZR 156/11",
|
|
explanation=f"Verschwiegene behördliche Stilllegung der Hauptwärmequelle im Wohnzimmer zum 01.01.2025. Minderungsanspruch von ca. {monthly_reduction} € monatlich über 15 Monate (gesamt {total_reduction:.2f} €)."
|
|
)]
|
|
|
|
@staticmethod
|
|
def verify_statutory_objection_window(bill: BillPeriod, evaluation_date: date) -> Tuple[bool, int]:
|
|
expiry_year = bill.bill_date.year + 1
|
|
expiry_date = date(expiry_year, bill.bill_date.month, bill.bill_date.day)
|
|
is_open = evaluation_date <= expiry_date
|
|
days_remaining = (expiry_date - evaluation_date).days
|
|
return is_open, days_remaining
|