"""Validation schemas for data operations."""

from pydantic import field_validator

from .base import Base
from .crawler import CrawlerToData


class InputToData(CrawlerToData):
    """
    Validation schema for data input operations.

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


class DataToDatabase(InputToData):
    """Validation schema for data-to-database operations."""

    id: str
    InputToData_validated_at: str

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


class DataToCustomerDatabase(Base):
    """Validation schema for customer database output."""

    id: str
    config_execution_row: str
    scraping_result: str

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