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

from __future__ import annotations

from typing import Literal, Optional, Union

from pydantic import BaseModel, Field
from typing_extensions import TypeAlias

Boolean: TypeAlias = bool
"""
The `Boolean` scalar type represents `true` or `false`.
"""


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


SimpleString: TypeAlias = str


String: TypeAlias = 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__: Optional[Literal['Person']] = Field('Person', alias='__typename')


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


UnionType: TypeAlias = Union[
    'Person',
    'Pet',
]


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