"""Validation schemas for proxy operations."""

from typing import Any

from pydantic import field_validator

from .base import Base
from .crawl import CrawlToProxy


class InputToProxy(CrawlToProxy):
    """
    Validation schema for proxy input data.

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


class ProxyToCrawler(InputToProxy):
    """Validation schema for proxy-to-crawler operations."""

    set_proxy_account: dict[str, Any]
    InputToProxy_validated_at: str

    @field_validator(
        "InputToProxy_validated_at",
        mode="after",
    )
    @classmethod
    def validate_string_fields(cls, v: str) -> str:
        return Base.validate_non_empty_string(v)

    @field_validator("set_proxy_account", mode="after")
    @classmethod
    def validate_dict_fields(cls, v: dict[str, Any]) -> dict[str, Any]:
        return Base.validate_non_empty_dict(v)
