"""Validation schemas for crawl operations."""

from pydantic import field_validator

from .base import Base
from .config import ConfigToCrawl


class InputToCrawl(ConfigToCrawl):
    """
    Validation schema for crawl input data.

    Note: No additional timestamp field required here.
    The ValidationHandler adds InputToCrawl_validated_at when this class is validated.
    """


class CrawlToProxy(InputToCrawl):
    """Validation schema for crawl-to-proxy operations."""

    rule_proxy_account_name: str
    strategy_proxy_fallback_account_name: str
    rule_proxy_service_name: str
    strategy_proxy_fallback_service_name: str
    InputToCrawl_validated_at: str

    @field_validator(
        "rule_proxy_account_name",
        "strategy_proxy_fallback_account_name",
        "rule_proxy_service_name",
        "strategy_proxy_fallback_service_name",
        "InputToCrawl_validated_at",
        mode="after",
    )
    @classmethod
    def validate_string_fields(cls, v: str) -> str:
        return Base.validate_non_empty_string(v)
