[build-system]
requires = ["hatchling<1.25"]
build-backend = "hatchling.build"

[project]
name = "oehrpy"
version = "0.6.0"
description = "A Python SDK for openEHR with type-safe Reference Model classes, template builders, and EHRBase client"
readme = "README.md"
requires-python = ">=3.10"
license = {text = "MIT"}
authors = [
    { name = "Open CIS Project" }
]
classifiers = [
    "Development Status :: 3 - Alpha",
    "Intended Audience :: Developers",
    "Intended Audience :: Healthcare Industry",
    "License :: OSI Approved :: MIT License",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.10",
    "Programming Language :: Python :: 3.11",
    "Programming Language :: Python :: 3.12",
    "Programming Language :: Python :: 3.13",
    "Topic :: Scientific/Engineering :: Medical Science Apps.",
    "Typing :: Typed",
]
keywords = ["openehr", "healthcare", "ehr", "clinical", "sdk", "pydantic", "ehrbase", "aql"]
dependencies = [
    "pydantic>=2.0",
    "httpx>=0.25",
    "defusedxml>=0.7",
]

[project.optional-dependencies]
dev = [
    "pytest>=7.0",
    "pytest-asyncio>=0.21",
    "mypy>=1.0",
    "ruff>=0.1",
    "types-defusedxml>=0.7",
]
generator = [
    "jinja2>=3.0",
    "lxml>=4.9",
]

[project.scripts]
oehrpy-validate-opt = "openehr_sdk.validate_opt_cli:main"

[project.urls]
Homepage = "https://github.com/platzhersh/oehrpy"
Documentation = "https://github.com/platzhersh/oehrpy#readme"
Repository = "https://github.com/platzhersh/oehrpy"
Issues = "https://github.com/platzhersh/oehrpy/issues"

[tool.hatch.build.targets.wheel]
packages = ["src/openehr_sdk"]

[tool.mypy]
python_version = "3.10"
strict = true
warn_return_any = true
warn_unused_configs = true

[[tool.mypy.overrides]]
module = "openehr_sdk.rm.rm_types"
disable_error_code = ["type-arg"]  # Generated code uses untyped lists

[tool.ruff]
target-version = "py310"
line-length = 100

[tool.ruff.lint]
select = ["E", "F", "I", "N", "W", "UP", "B", "C4", "SIM"]

[tool.ruff.lint.per-file-ignores]
"src/openehr_sdk/rm/*.py" = ["N801", "N817", "E402", "SIM105"]  # Generated code
"generator/*.py" = ["E501", "F541", "F401"]  # Generator code (long lines, f-strings, unused imports)
"src/openehr_sdk/templates/opt_parser.py" = ["N817"]  # Allow ET as acronym for ElementTree
"src/openehr_sdk/client/ehrbase.py" = ["N817"]  # Allow ET as acronym for ElementTree
"tests/**/*.py" = ["E501"]  # Test assertions with long FLAT paths

[tool.semantic_release]
version_toml = ["pyproject.toml:project.version"]
version_variables = ["src/openehr_sdk/__init__.py:__version__"]
branch = "main"
build_command = "pip install build && python -m build"
commit_message = "chore(release): {version}"
major_on_zero = false

[tool.semantic_release.changelog]
template_dir = "templates"
changelog_file = "CHANGELOG.md"

[tool.semantic_release.remote]
type = "github"
token = { env = "GH_TOKEN" }

[tool.semantic_release.publish]
upload_to_vcs_release = true

[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests"]
markers = [
    "integration: marks tests as integration tests (require EHRBase)",
]
