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

from __future__ import annotations

from typing import Literal

from pydantic import BaseModel, Field, RootModel


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


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


class Animal(BaseModel):
    kind: Literal['snake', 'rabbit'] | None = None


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


class EnumObject(BaseModel):
    type: Literal['a', 'b'] | None = None


class EnumRoot(RootModel[Literal['a', 'b']]):
    root: Literal['a', 'b']


class IntEnum(RootModel[Literal[1, 2]]):
    root: Literal[1, 2]


class AliasEnum(RootModel[Literal[1, 2, 3]]):
    root: Literal[1, 2, 3]


class MultipleTypeEnum(RootModel[Literal['red', 'amber', 'green', 42] | None]):
    root: Literal['red', 'amber', 'green', 42] | None


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


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


class NestedNullableEnum(BaseModel):
    nested_version: Literal['RC1', 'RC1N', 'RC2', 'RC2N', 'RC3', 'RC4'] | None = Field(
        'RC1', description='nullable enum', examples=['RC2']
    )


class Version(RootModel[Literal['RC1', 'RC1N', 'RC2', 'RC2N', 'RC3', 'RC4'] | None]):
    root: Literal['RC1', 'RC1N', 'RC2', 'RC2N', 'RC3', 'RC4'] | None = Field(
        'RC1', description='nullable enum', examples=['RC2']
    )
