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

from __future__ import annotations

from enum import Enum
from typing import Literal

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


class Second(BaseModel):
    inlineChild: constr(min_length=2)


class ArrayFacet(RootModel[list[str]]):
    root: list[str] = Field(..., max_length=4, min_length=1, title='ArrayFacet')


class BooleanFacet(Enum):
    boolean_True = True


class IncludedCode(RootModel[constr(pattern=r'[A-Z]+', min_length=3, max_length=3)]):
    root: constr(pattern=r'[A-Z]+', min_length=3, max_length=3) = Field(
        ..., description='Included code docs', title='IncludedCode'
    )


class InlineTokenListEnum(Enum):
    a = 'a'
    b = 'b'


class InlineTokenList(RootModel[list[InlineTokenListEnum]]):
    root: list[InlineTokenListEnum] = Field(..., title='InlineTokenList')


class NumericFacet(Enum):
    number_1_5 = 1.5


class TextAlias(RootModel[str]):
    root: str = Field(..., description='Text alias docs', title='TextAlias')


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


class Amount(BaseModel):
    value: conint(ge=1, le=2147483647)
    unit: str | None = None


class FallbackContent(BaseModel):
    pass


class InlineRestrictedText(BaseModel):
    value: constr(min_length=2, max_length=6)
    code: str


class RestrictedType(BaseModel):
    only: str


class TextWithAttrs(BaseModel):
    value: str
    kind: Literal['plain'] = 'plain'
    emptyFixed: Literal[''] = ''


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


class MixedUnion(RootModel[str | TokenList | conint(ge=1, le=2147483647)]):
    root: str | TokenList | conint(ge=1, le=2147483647) = Field(..., title='MixedUnion')


class BaseType(BaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    sharedElement: list[SharedElement | None] | None = Field(None, max_length=2)
    left: str | None = None
    right: str | None = None
    fromGroup: str | None = None
    localNumber: conint(ge=-2147483648, le=2147483647) | None = 1
    inlineAttribute: constr(max_length=8) | None = None
    globalFlag: Literal[True]
    emptyDefault: str | None = ''


class ExtendedType(BaseType):
    extra: list[str] | None = Field(None, max_length=3)


class Model(BaseModel):
    sharedElement: str = Field(..., title='SharedElement')
    first: ExtendedType
    inlineRestrictedText: InlineRestrictedText
    second: Second = Field(..., title='Second')
