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

from __future__ import annotations

from typing import Optional, Union

from pydantic import BaseModel, ConfigDict, Field, RootModel


class MySchema1(BaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    AddressLine1: str
    AddressLine2: Optional[str] = None
    City: Optional[str] = None
    State: Optional[str] = None
    ZipCode: str


class MySchema2(BaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    AddressLine1: str
    AddressLine2: Optional[str] = None
    City: Optional[str] = None
    County: Optional[str] = None
    PostCode: str


class US(BaseModel):
    County: Optional[str] = None
    PostCode: str


class MySchema3(US):
    model_config = ConfigDict(
        extra='allow',
    )
    AddressLine1: str
    AddressLine2: Optional[str] = None
    City: Optional[str] = None


class MySchema(RootModel[Union[MySchema1, MySchema2, MySchema3]]):
    root: Union[MySchema1, MySchema2, MySchema3] = Field(
        ..., title='My schema', union_mode='left_to_right'
    )
