cadrumo.domain.calculations.registry.ledger_renta_gastos_pago_fraccionado_bindings module

Canonical M130 pago-fraccionado ledger-gastos binding family.

class RentaGastosPagoFraccionadoObservationProtocol(*args, **kwargs)[source]

Bases: Protocol

Structural protocol for M130 pago-fraccionado gastos observations.

The registry only needs these two attributes to resolve ledger_renta_gastos_pago_fraccionado_aggregation bindings; the full RentaGastoObservation satisfies this protocol without any explicit declaration. Mirrors RentaIncomeObservationProtocol for the gastos dimension.

property target_casilla_id: CasillaId

Return the declaration casilla receiving the deductible amount.

property deductible_amount: Decimal

Return the deductible amount carried by the observation.

validate_ledger_renta_gastos_pago_fraccionado_aggregation_binding_definition(binding)[source]

Validate a ledger_renta_gastos_pago_fraccionado_aggregation binding definition.

Return type:

None

Parameters:

binding (BindingDefinition)

resolve_ledger_renta_gastos_pago_fraccionado_aggregation_binding_values(revision, observations)[source]

Resolve every ledger_renta_gastos_pago_fraccionado_aggregation binding on revision.

Matches observations by target_casilla_id and sums their deductible_amount, mirroring the income resolver’s casilla-keyed fold. Delegates the filter/aggregate skeleton to resolve_ledger_family_binding_values(), shared by every ledger family resolver.

Parameters:
Return type:

dict[TypeAliasType, Decimal]

unsupported_ledger_renta_gastos_pago_fraccionado_observations(revision, observations)[source]

Return the gasto observations no ledger_renta_gastos_pago_fraccionado_aggregation binding can consume.

revision is the ModeloRevision whose declared bindings define what is consumable.

Delegates the screen to unsupported_ledger_family_observations() — see that function for the shared fail-closed contract (why an unmatched observation is a modelling gap, not a legitimate zero). This family’s own contribution is narrow: the target_casilla_id match predicate (reused from the resolver’s _renta_gastos_pago_fraccionado_build_matcher) and a zero-deductible_amount false-fire guard — a gasto that contributes nothing declarable is excluded whether or not it is routed. No extra_exclusion; unlike the IVA family this family has no category-level carve-out.

Return type:

tuple[RentaGastosPagoFraccionadoObservationProtocol, ...]

Returns:

Unsupported RentaGastosPagoFraccionadoObservationProtocol observations.

Parameters:
validate_ledger_renta_gastos_pago_fraccionado_aggregation_binding(binding)[source]

Validate a ledger_renta_gastos_pago_fraccionado_aggregation binding at registry-build time.

Accumulating list[str] validator over LedgerRentaGastosPagoFraccionadoProvider; runs the casilla / fact / aggregation-op invariant at build time through invariant_diagnostics(), whose raise-style body is validate_ledger_renta_gastos_pago_fraccionado_aggregation_binding_definition().

Return type:

list[str]

Parameters:

binding (BindingDefinition)

class LedgerRentaGastosPagoFraccionadoProvider(**data)[source]

Bases: BaseModel

Validated form of a ledger_renta_gastos_pago_fraccionado_aggregation binding selector.

modelo is fixed to the M130 series (the only model sourcing gastos via this cumulative path). target_casilla_id is casilla 02 (“Gastos”). No period axis: the cumulative year-to-date window is applied by the application aggregator, exactly as for the income sibling.

Parameters:

data (Any)

kind: Literal[BindingSourceKind.LEDGER_RENTA_GASTOS_PAGO_FRACCIONADO_AGGREGATION]
modelo: Modelo
target_casilla_id: CasillaId
fact: Literal['deductible_amount_sum']