# generated by datamodel-codegen:
#   filename:  edge_cases.xsd
#   timestamp: 2019-07-26T00:00:00+00:00

from __future__ import annotations

from decimal import Decimal
from typing import Any, Literal

from pydantic import BaseModel, ConfigDict, Field, RootModel, confloat, conint, constr


class AfterTopAttributes(RootModel[str]):
    root: str = Field(..., title='AfterTopAttributes')


class DuplicateName(RootModel[str]):
    root: str = Field(..., title='DuplicateName')


class EmptyRestriction(RootModel[str]):
    root: str = Field(..., title='EmptyRestriction')


class SelfRestricted(RootModel[constr(pattern=r'[A-Z]+')]):
    root: constr(pattern=r'[A-Z]+') = Field(..., title='SelfRestricted')


class NotAPythonType(RootModel[str]):
    root: str = Field(..., title='NotAPythonType')


class Loose(BaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    inlineGroupElement: Literal['v'] = Field(
        ..., description='Element docs\n\nMore element docs'
    )
    optionalGrouped: str | None = None
    badGrouped: list[str] = Field(..., max_length=2)
    not_a_python_name: str = Field(..., alias='not-a-python-name')
    unboundedItem: list[str] | None = None
    badOccurs: list[str] = Field(..., min_length=1)
    empty: Any
    unknownNamespace: Any
    badDoubleDefault: float
    infiniteDoubleDefault: float
    doubleRange: confloat(ge=1.5, lt=10.5)
    badDecimalDefault: Decimal
    badIntDefault: conint(ge=-2147483648, le=2147483647)
    localGrouped: str | None = Field(None, description='Grouped attr')


class NoSimpleChild(BaseModel):
    value: str


class Model(BaseModel):
    plain: str = Field(..., title='Plain')
    loose: Loose
    selfRestricted: SelfRestricted
