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

from __future__ import annotations

from typing import Literal, Union

from pydantic import BaseModel, Field
from typing_extensions import TypeAliasType

Boolean = TypeAliasType("Boolean", bool)
"""
The `Boolean` scalar type represents `true` or `false`.
"""


Int = TypeAliasType("Int", int)
"""
The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.
"""


SimpleString = TypeAliasType("SimpleString", str)


String = TypeAliasType("String", str)
"""
The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.
"""


class Person(BaseModel):
    age: Int
    name: String
    typename__: Literal['Person'] | None = Field('Person', alias='__typename')


class Pet(BaseModel):
    name: String
    type: String
    typename__: Literal['Pet'] | None = Field('Pet', alias='__typename')


UnionType = TypeAliasType(
    "UnionType",
    Union[
        'Person',
        'Pet',
    ],
)


class ModelWithTypeAliasField(BaseModel):
    simple_field: SimpleString | None = None
    string_field: String | None = None
    union_field: UnionType | None = None
    typename__: Literal['ModelWithTypeAliasField'] | None = Field(
        'ModelWithTypeAliasField', alias='__typename'
    )
