# generated by datamodel-codegen:
#   filename:  discriminator_enum_duplicate.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


class Cat(BaseModel):
    pet_type: Literal['cat'] = Field(..., title='Pet Type')
    meows: int = Field(..., title='Meows')


class Dog(BaseModel):
    pet_type: Literal['dog'] = Field(..., title='Pet Type')
    barks: float = Field(..., title='Barks')


class PetType(Enum):
    reptile = 'reptile'
    lizard = 'lizard'


class Lizard(BaseModel):
    pet_type: Literal['lizard', 'reptile'] = Field(..., title='Pet Type')
    scales: bool = Field(..., title='Scales')


class Animal(BaseModel):
    pet: Cat | Dog | Lizard | None = Field(None, discriminator='pet_type', title='Pet')
    n: int | None = Field(None, title='N')
