# generated by datamodel-codegen:
#   filename:  Foo.json

from __future__ import annotations

from enum import Enum
from typing import Optional

from pydantic import ConfigDict, Field

from oold.model import LinkedBaseModel


class LengthUnit(str, Enum):
    meter = "Item:OSWf101d25e944856e3bd4b4c9863db7de2"
    milli_meter = (
        "Item:OSWf101d25e944856e3bd4b4c9863db7de2#OSW322dec469be75aedb008b3ebff29db86"
    )
    kilo_meter = (
        "Item:OSWf101d25e944856e3bd4b4c9863db7de2#OSWb1de8f91f1275572b37c2edfe40d5de6"
    )


class Bar2(LinkedBaseModel):
    model_config = ConfigDict(
        json_schema_extra={
            "@context": {
                "id": "@id",
                "type": "@type",
                "ex": "http://example.com/",
                "@base": "http://example.com/",
                "prop1": "ex:prop1",
            },
            "uuid": "bar2/Bar2.json",
            "title": "Bar2",
        },
    )
    id: Optional[str] = None
    type: Optional[list[str]] = ["Bar2"]
    prop1: Optional[str] = None
    unit: Optional[LengthUnit] = Field(
        None,
        json_schema_extra={
            "defaut": "Item:OSWf101d25e944856e3bd4b4c9863db7de2",
            "$comment": "enum_titles are valid variable names and follow latex SI unit notation with '\\' replaced with '_'",
            "x-enum-varnames": ["meter", "milli_meter", "kilo_meter"],
            "enum_titles*": {
                "$comment": "Human friedly symbols",
                "en": ["m", "mm", "km"],
            },
        },
        title="LengthUnit",
    )


class Bar(Bar2):
    model_config = ConfigDict(
        json_schema_extra={"@context": ["./bar2/Bar2.json"], "title": "Bar"},
    )
    type: Optional[list[str]] = ["Bar"]
    prop2: Optional[str] = None
    unit: Optional[str] = Field(
        None,
        json_schema_extra={"_allOf": [{"$ref": "./bar2/Bar2.json#/properties/unit"}]},
        title="DiameterUnit",
    )


class Foo(LinkedBaseModel):
    model_config = ConfigDict(
        json_schema_extra={"title": "Foo"},
    )
    id: Optional[str] = None
    type: Optional[list[str]] = ["Foo"]
    literal: Optional[str] = None
    b: Optional[Bar] = Field(None, json_schema_extra={"range": "Bar.json"})
    b2: Optional[list[Bar]] = Field(None, json_schema_extra={"range": "Bar.json"})
