# generated by datamodel-codegen:
#   filename:  type/basic.json
#   timestamp: 2022-10-04T14:49:18+00:00

from __future__ import annotations

from datetime import date, datetime
from typing import Any, Optional
from uuid import UUID

from pydantic import AnyUrl, BaseModel, EmailStr, Extra, Field, constr


class Basic(BaseModel):
    __root__: Any = Field(
        ...,
        description='This schema defines basic common types that are used by other schemas.',
        title='Basic',
    )


class Integer(BaseModel):
    __root__: int = Field(..., description='An integer type.')


class Number(BaseModel):
    __root__: int = Field(
        ...,
        description='A numeric type that includes integer or floating point numbers.',
    )


class String(BaseModel):
    __root__: str = Field(..., description='A String type.')


class Uuid(BaseModel):
    __root__: UUID = Field(..., description='Unique id used to identify an entity.')


class Email(BaseModel):
    __root__: EmailStr = Field(
        ..., description='Email address of a user or other entities.'
    )


class Timestamp(BaseModel):
    __root__: int = Field(..., description='Timestamp in Unix epoch time milliseconds.')


class Href(BaseModel):
    __root__: AnyUrl = Field(..., description='URI that points to a resource.')


class TimeInterval(BaseModel):
    class Config:
        extra = Extra.forbid

    start: Optional[int] = Field(None, description='Start time in unixTimeMillis.')
    end: Optional[int] = Field(None, description='End time in unixTimeMillis.')


class Duration(BaseModel):
    __root__: str = Field(
        ..., description="Duration in ISO 8601 format in UTC. Example - 'P23DT23H'."
    )


class Date(BaseModel):
    __root__: date = Field(
        ..., description="Date in ISO 8601 format in UTC. Example - '2018-11-13'."
    )


class DateTime(BaseModel):
    __root__: datetime = Field(
        ...,
        description="Date and time in ISO 8601 format. Example - '2018-11-13T20:20:39+00:00'.",
    )


class EntityLink(BaseModel):
    __root__: constr(regex=r'^<#E::\S+::\S+>$') = Field(
        ...,
        description='Link to an entity or field within an entity using this format `<#E::{entities}::{entityType}::{field}::{arrayFieldName}::{arrayFieldValue}`.',
    )


class EntityName(BaseModel):
    __root__: constr(min_length=1, max_length=128) = Field(
        ..., description='Name that identifies a entity.'
    )


class FullyQualifiedEntityName(BaseModel):
    __root__: constr(min_length=1, max_length=256) = Field(
        ...,
        description="A unique name that identifies an entity. Example for table 'DatabaseService:Database:Table'.",
    )


class SqlQuery(BaseModel):
    class Config:
        extra = Extra.forbid

    __root__: str = Field(
        ..., description="SQL query statement. Example - 'select * from orders'."
    )


class SqlFunction(BaseModel):
    __root__: str = Field(
        ..., description="SQL function. Example - 'AVG()`, `COUNT()`, etc.."
    )


class Markdown(BaseModel):
    __root__: str = Field(..., description='Text in Markdown format.')


class Expression(BaseModel):
    __root__: str = Field(..., description='Expression in SpEL.')


class JsonSchema(BaseModel):
    __root__: str = Field(
        ...,
        description='JSON schema encoded as string. This will be used to validate the JSON fields using this schema.',
    )


class EntityExtension(BaseModel):
    __root__: Any = Field(
        ...,
        description='Entity extension data with custom attributes added to the entity.',
    )
