from pydantic import validator

from orchestrator.types import State

from surf.utils.exceptions import FieldValueError


def validate_something(foo: str | None, values: State) -> str | None:
    if foo:
        message = "TODO: implement this!"
        raise FieldValueError(message)

    return foo

{% for validation in validations %}
def {{ validation.validation.id }}_validator() -> classmethod:
    return validator("{{ validation.resource_type.name }}", allow_reuse=True)(validate_something)

{% endfor -%}
