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

from __future__ import annotations

from typing import Literal

from pydantic import BaseModel, Field, RootModel


class Zoo(BaseModel):
    animals: list[Animals] | None = Field([], title='Animals', validate_default=True)


class Dog(BaseModel):
    name: Literal['dog'] = Field('dog', title='woof')
    friends: list[Friends] | None = Field([], title='Friends', validate_default=True)


class Cat(BaseModel):
    name: Literal['cat'] = Field('cat', title='meow')
    friends: list[Friends] | None = Field([], title='Friends', validate_default=True)


class Bird(BaseModel):
    name: Literal['bird'] = Field('bird', title='chirp')
    friends: list[Friends] | None = Field([], title='Friends', validate_default=True)


class Animals(RootModel[Dog | Cat | Bird]):
    root: Dog | Cat | Bird = Field(..., discriminator='name', title='Animal')


class Friends(RootModel[Dog | Cat | Bird]):
    root: Dog | Cat | Bird = Field(..., discriminator='name', title='Animal')


Zoo.model_rebuild()
Dog.model_rebuild()
Cat.model_rebuild()
Bird.model_rebuild()
