# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .editor_field_validation_max import EditorFieldValidationMax
from .editor_field_validation_min import EditorFieldValidationMin


class EditorFieldValidation(UniversalBaseModel):
    """
    Validation rules for an editor field.
    """

    required: typing.Optional[bool] = None
    min: typing.Optional[EditorFieldValidationMin] = None
    max: typing.Optional[EditorFieldValidationMax] = None
    step: typing.Optional[float] = None
    min_length: typing.Optional[int] = None
    max_length: typing.Optional[int] = None
    max_items: typing.Optional[int] = None
    pattern: typing.Optional[str] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
