# generated by datamodel-codegen:
#   filename:  recursive_ref_discriminator.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, ConfigDict, Field, RootModel


class Type(Enum):
    eq = 'eq'
    ne = 'ne'


class ComparisonFilter(BaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    type: Literal['ComparisonFilter']
    key: str
    value: str


class Type1(Enum):
    and_ = 'and'
    or_ = 'or'


class CompoundFilter(BaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    type: Literal['CompoundFilter']
    filters: list[Filters]


class Filters(RootModel[ComparisonFilter | CompoundFilter]):
    root: ComparisonFilter | CompoundFilter = Field(..., discriminator='type')


CompoundFilter.model_rebuild()
