# Auto-generated by gen-pydantic from scala_metamodel.yaml — DO NOT EDIT
from __future__ import annotations 

import re
import sys
from datetime import (
    date,
    datetime,
    time
)
from decimal import Decimal 
from enum import Enum 
from typing import (
    Any,
    ClassVar,
    Literal,
    Optional,
    Union
)

from pydantic import (
    BaseModel,
    ConfigDict,
    Field,
    RootModel,
    field_validator
)


metamodel_version = "None"
version = "None"


class ConfiguredBaseModel(BaseModel):
    model_config = ConfigDict(
        validate_assignment = True,
        validate_default = True,
        extra = "forbid",
        arbitrary_types_allowed = True,
        use_enum_values = True,
        strict = False,
    )
    pass




class LinkMLMeta(RootModel):
    root: dict[str, Any] = {}
    model_config = ConfigDict(frozen=True)

    def __getattr__(self, key:str):
        return getattr(self.root, key)

    def __getitem__(self, key:str):
        return self.root[key]

    def __setitem__(self, key:str, value):
        self.root[key] = value

    def __contains__(self, key:str) -> bool:
        return key in self.root


linkml_meta = LinkMLMeta({'default_prefix': 'https://w3id.org/linkml-scala/metamodel/',
     'id': 'https://w3id.org/linkml-scala/metamodel',
     'imports': ['linkml:types'],
     'name': 'scala_metamodel',
     'prefixes': {'linkml': {'prefix_prefix': 'linkml',
                             'prefix_reference': 'https://w3id.org/linkml/'},
                  'scala_meta': {'prefix_prefix': 'scala_meta',
                                 'prefix_reference': 'https://w3id.org/linkml-scala/'}},
     'source_file': 'src/linkml_scala/scala_metamodel.yaml'} )


class OperationDefinition(ConfiguredBaseModel):
    """
    A method/operation on a trait or class. The return value follows standard LinkML slot conventions: range specifies the type (built-in or schema-defined class), multivalued wraps in List[T], and required controls Option[T] wrapping.
    """
    linkml_meta: ClassVar[LinkMLMeta] = LinkMLMeta({'from_schema': 'https://w3id.org/linkml-scala/metamodel'})

    name: str = Field(default=..., json_schema_extra = { "linkml_meta": {'alias': 'name', 'domain_of': ['OperationDefinition', 'ParameterDefinition']} })
    parameters: Optional[list[ParameterDefinition]] = Field(default=None, json_schema_extra = { "linkml_meta": {'alias': 'parameters', 'domain_of': ['OperationDefinition']} })
    range: Optional[str] = Field(default=None, description="""LinkML type name for the return value. Can be a built-in type (string, integer, boolean, etc.) or a class/enum defined in the schema. Defaults to Unit (void) if omitted.""", json_schema_extra = { "linkml_meta": {'alias': 'range', 'domain_of': ['OperationDefinition', 'ParameterDefinition']} })
    multivalued: Optional[bool] = Field(default=None, description="""If true, return type is wrapped in List[T].""", json_schema_extra = { "linkml_meta": {'alias': 'multivalued', 'domain_of': ['OperationDefinition']} })
    required: Optional[bool] = Field(default=None, description="""If false (default), return type is wrapped in Option[T]. If true, the bare type is used.""", json_schema_extra = { "linkml_meta": {'alias': 'required', 'domain_of': ['OperationDefinition']} })
    is_abstract: Optional[bool] = Field(default=None, description="""If true, no default implementation""", json_schema_extra = { "linkml_meta": {'alias': 'is_abstract', 'domain_of': ['OperationDefinition']} })
    body: Optional[str] = Field(default=None, description="""Optional default implementation code""", json_schema_extra = { "linkml_meta": {'alias': 'body', 'domain_of': ['OperationDefinition']} })


class ParameterDefinition(ConfiguredBaseModel):
    """
    A parameter to an operation
    """
    linkml_meta: ClassVar[LinkMLMeta] = LinkMLMeta({'from_schema': 'https://w3id.org/linkml-scala/metamodel'})

    name: str = Field(default=..., json_schema_extra = { "linkml_meta": {'alias': 'name', 'domain_of': ['OperationDefinition', 'ParameterDefinition']} })
    range: str = Field(default=..., json_schema_extra = { "linkml_meta": {'alias': 'range', 'domain_of': ['OperationDefinition', 'ParameterDefinition']} })
    default_value: Optional[str] = Field(default=None, json_schema_extra = { "linkml_meta": {'alias': 'default_value', 'domain_of': ['ParameterDefinition']} })


class ScalaClassAnnotation(ConfiguredBaseModel):
    """
    Extended annotations for Scala generation
    """
    linkml_meta: ClassVar[LinkMLMeta] = LinkMLMeta({'class_uri': 'scala_meta:ScalaClassAnnotation',
         'from_schema': 'https://w3id.org/linkml-scala/metamodel'})

    operations: Optional[list[OperationDefinition]] = Field(default=None, json_schema_extra = { "linkml_meta": {'alias': 'operations', 'domain_of': ['ScalaClassAnnotation']} })
    is_interface: Optional[bool] = Field(default=None, description="""Force generation as trait even if not a mixin""", json_schema_extra = { "linkml_meta": {'alias': 'is_interface', 'domain_of': ['ScalaClassAnnotation']} })
    companion_object: Optional[bool] = Field(default=None, description="""Generate a companion object""", json_schema_extra = { "linkml_meta": {'alias': 'companion_object', 'domain_of': ['ScalaClassAnnotation']} })


# Model rebuild
# see https://pydantic-docs.helpmanual.io/usage/models/#rebuilding-a-model
OperationDefinition.model_rebuild()
ParameterDefinition.model_rebuild()
ScalaClassAnnotation.model_rebuild()

