# Reusable geometric checks registered through the public validator extension point.
from hearth.kernel.validation import validator, state, fail
from hearth.blocks import solid, name_of


@validator('vertical-cover')
def vertical_cover(scene, node, rule):
    """Check actual weather cover along bounded world-vertical columns.

    Horizontal frame rotations preserve world Y. This is a voxel coverage check,
    not a fluid simulator or a structural-mechanics proof.
    """
    for x, y, z in rule.cells:
        if not any(solid(state(scene, (x, yy, z))) or 'glass' in name_of(state(scene, (x, yy, z))) for yy in range(y, rule.box.hi[1] + 1)):
            yield fail('roof-cover', node, (x, y, z), 'Weather skin has an uncovered column')
