from typing import Any


def cast_numeric_greater_than_zero(
    value: Any, value_name: str, required_type: type
) -> None:
    """
    Checks that `value` is greater than zero and casts
    it to `required_type`.

    Raises an exception `value` not greater than zero.

    Args:
        value: numeric value to check
        value_name: name to be included in the error message
        required_type: target type of the value

    Returns:
        value as required type
    """

    if not isinstance(value, required_type):
        value = required_type(value)

    if value <= 0:
        raise ValueError(f"Value {value_name} must be greater than zero.")

    return value