.PHONY: dev fetch score run list install ai help

URL ?= https://www.dba.dk/mobility/search/car?mileage_to=175000\&price_from=15000\&price_to=110000\&registration_class=1\&year_from=2014
UUID ?=
PREFS ?=

## Start udviklingsserver
dev:
	python3 -m uvicorn app:app --host 0.0.0.0 --port 8000 --reload

## Hent annoncer — ny søgning: make fetch URL="https://dba.dk/..."
##                gen-fetch:   make fetch UUID=<uuid>
fetch:
ifdef UUID
	python3 fetch_dba.py $(UUID)
else
	python3 fetch_dba.py "$(URL)"
endif

## Score annoncer — make score UUID=<uuid> [PREFS="ingen franske biler"]
score:
ifdef UUID
	python3 score.py $(UUID) $(if $(PREFS),--prefs "$(PREFS)",)
else
	python3 score.py $(if $(PREFS),--prefs "$(PREFS)",)
endif

## Hent + score i ét hak
run: fetch score

## List alle søgninger
list:
	python3 fetch_dba.py --list

## Installer Python-afhængigheder
install:
	pip install fastapi uvicorn python-multipart anthropic requests jinja2

## Genoptag Copilot session
ai:
	copilot --resume=2093191e-06df-4810-b13f-076be1f8995b

## Vis denne hjælp
help:
	@grep -E '^##' Makefile | sed 's/## //'
