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

from __future__ import annotations

from decimal import Decimal
from typing import Literal

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


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


class StampInclusiveRange(RootModel[AwareDatetime]):
    root: AwareDatetime = Field(..., title='StampInclusiveRange')


class StampRange(RootModel[AwareDatetime]):
    root: AwareDatetime = Field(..., title='StampRange')


class AllParticleType(BaseModel):
    first: str
    maybe: conint(ge=-2147483648, le=2147483647) | None = None


class RestrictedAllType(BaseModel):
    first: str
    restrictedAttr: Literal[False] = False


class AnonymousComplex(BaseModel):
    value: Decimal
    flag: bool | None = True


class TextWithLanguage(BaseModel):
    value: str
    lang: str
    globalCode: Literal['fixedCode'] = 'fixedCode'


class ScopedTypes(BaseModel):
    anonymousSimple: constr(pattern=r'[a-z]{2}')
    anonymousComplex: AnonymousComplex
    text: TextWithLanguage
    ids: IdList | None = None
    stamp: StampRange | None = None
    inclusiveStamp: StampInclusiveRange | None = None


class Catalog(BaseModel):
    scoped: ScopedTypes
    allParticle: AllParticleType | None = None
    restrictedAll: RestrictedAllType | None = None
    globalCode: str
