# generated by datamodel-codegen:
#   filename:  Entity.json
#   timestamp: 2023-07-22T07:29:50+00:00

from __future__ import annotations

from enum import Enum
from typing import List, Optional, Union
from uuid import UUID

from pydantic import Field

from osw.model.static import OswBaseModel


class LangCode(Enum):
    en = "en"
    de = "de"


from typing import Type, TypeVar
from uuid import uuid4

from osw.model.static import Ontology, OswBaseModel


class Label(OswBaseModel):
    text: str = Field(..., title="Text")
    lang: Optional[LangCode] = Field("en", title="Lang code")


class Description(OswBaseModel):
    text: str = Field(..., title="Text")
    lang: Optional[LangCode] = Field("en", title="Lang code")


class Statement(OswBaseModel):
    uuid: UUID = Field(default_factory=uuid4, title="UUID")
    label: Optional[List[Label]] = Field(None, title="Label")
    """
    Human readable name
    """
    subject: Optional[str] = Field(None, title="Subject")
    substatements: Optional[
        List[Union[ObjectStatement, DataStatement, QuantityStatement]]
    ] = Field(None, title="Substatements")


class ObjectStatement(Statement):
    predicate: str = Field(..., title="Predicate")
    object: str = Field(..., title="Object")


class DataStatement(Statement):
    property: str = Field(..., title="Property")
    value: str = Field(..., title="Value")


class QuantityStatement(Statement):
    quantity: str = Field(..., title="Property")
    numerical_value: str = Field(..., title="Value")
    unit: str = Field(..., title="Unit")
    unit_symbol: str
    value: str = Field(..., title="Value")


class Entity(OswBaseModel):
    uuid: UUID = Field(default_factory=uuid4, title="UUID")
    name: Optional[str] = Field(None, title="Name")
    """
    Technical / Machine compatible name
    """
    label: List[Label] = Field(..., min_items=1, title="Labels")
    """
    Human readable names. You have to assign at least one.
    """
    short_name: Optional[List[Label]] = Field(None, title="Short name")
    """
    Abbreviation, Acronym, etc.
    """
    query_label: Optional[str] = Field(None, title="Label")
    description: Optional[List[Description]] = Field(None, title="Description")
    image: Optional[str] = Field(None, title="Image")
    based_on: Optional[List[str]] = Field(None, title="Based on")
    """
    Other entities on which this one is based, e.g. when it is created by copying
    """
    statements: Optional[
        List[Union[ObjectStatement, DataStatement, QuantityStatement]]
    ] = Field(None, title="Statements")
    attachments: Optional[List[str]] = Field(None, title="File attachments")


Entity.update_forward_refs()
Statement.update_forward_refs()
ObjectStatement.update_forward_refs()
DataStatement.update_forward_refs()
QuantityStatement.update_forward_refs()
# generated by datamodel-codegen:
#   filename:  Item.json
#   timestamp: 2023-07-22T07:29:52+00:00


from enum import Enum
from typing import List, Optional, Union
from uuid import UUID

from pydantic import Field

from osw.model.static import OswBaseModel


class Level(Enum):
    public = "public"
    internal = "internal"
    restricted = "restricted"


class ReadAccess(OswBaseModel):
    level: Optional[Level] = Field(None, title="Level")


class AccessRestrictions(OswBaseModel):
    read: Optional[ReadAccess] = Field(None, title="Read access")


class Item(Entity):
    type: Optional[List[str]] = Field(
        ["Category:Item"], min_items=1, title="Types/Categories"
    )
    entry_access: Optional[AccessRestrictions] = Field(
        None, title="Access restrictions"
    )


Entity.update_forward_refs()
Statement.update_forward_refs()
ObjectStatement.update_forward_refs()
DataStatement.update_forward_refs()
QuantityStatement.update_forward_refs()
Item.update_forward_refs()
