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

from __future__ import annotations

from enum import Enum
from typing import Literal

from pydantic import BaseModel, Field, RootModel


class Kind(Enum):
    dog = 'dog'
    cat = 'cat'


class Pet(BaseModel):
    id: int
    name: str
    tag: str | None = None
    kind: Kind | None = None
    type: Literal['animal'] | None = None
    number: Literal[1] = 1
    boolean: Literal[True] = True


class Pets(RootModel[list[Pet]]):
    root: list[Pet]


class Kind1(Enum):
    snake = 'snake'
    rabbit = 'rabbit'


class Animal(BaseModel):
    kind: Kind1 | None = None


class Error(BaseModel):
    code: int
    message: str


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


class EnumObject(BaseModel):
    type: Type | None = None


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


class IntEnum(Enum):
    number_1 = 1
    number_2 = 2


class AliasEnum(Enum):
    a = 1
    b = 2
    c = 3


class MultipleTypeEnum(Enum):
    red = 'red'
    amber = 'amber'
    green = 'green'
    NoneType_None = None
    int_42 = 42


class SingleEnum(RootModel[Literal['pet']]):
    root: Literal['pet'] = 'pet'


class ArrayEnum(RootModel[list[Literal['cat'] | Literal['dog']]]):
    root: list[Literal['cat'] | Literal['dog']]


class NestedVersionEnum(Enum):
    RC1 = 'RC1'
    RC1N = 'RC1N'
    RC2 = 'RC2'
    RC2N = 'RC2N'
    RC3 = 'RC3'
    RC4 = 'RC4'


class NestedVersion(RootModel[NestedVersionEnum | None]):
    root: NestedVersionEnum | None = Field(
        'RC1', description='nullable enum', examples=['RC2']
    )


class NestedNullableEnum(BaseModel):
    nested_version: NestedVersion | None = Field(
        'RC1', description='nullable enum', examples=['RC2'], validate_default=True
    )


class VersionEnum(Enum):
    RC1 = 'RC1'
    RC1N = 'RC1N'
    RC2 = 'RC2'
    RC2N = 'RC2N'
    RC3 = 'RC3'
    RC4 = 'RC4'


class Version(RootModel[VersionEnum | None]):
    root: VersionEnum | None = Field(
        'RC1', description='nullable enum', examples=['RC2']
    )
