.PHONY: install lint lint-fix security mypy pyright test coverage build publish check

install:  ## Instala el paquete y las herramientas de desarrollo
	pip install -e ".[dev]"

lint:  ## Comprueba el estilo del código con ruff
	ruff check src tests

lint-fix:  ## Corrige automáticamente los problemas que ruff puede resolver
	ruff check --fix src tests

security:  ## Análisis estático de seguridad con bandit
	bandit --recursive --configfile pyproject.toml src

mypy:  ## Comprueba los tipos con mypy
	mypy src

pyright:  ## Comprueba los tipos con pyright (mismo motor que Pylance)
	pyright src

test:  ## Ejecuta los tests
	pytest -v

coverage:  ## Ejecuta los tests con informe de cobertura
	pytest --cov=buscador_propiedad_vertical --cov-report=term-missing

build:  ## Genera los artefactos de distribución (wheel + sdist)
	pip install --quiet build
	python -m build

publish: build  ## Publica en PyPI (requiere PYPI_TOKEN en el entorno)
	pip install --quiet twine
	twine upload dist/* --username __token__ --password $(PYPI_TOKEN)

check: security lint mypy pyright test  ## Ejecuta todos los checks (igual que el pipeline)
