"""EX-B2-11: three endpoints, one business condition, inconsistent contracts."""

from fastapi import FastAPI, HTTPException
from fastapi.responses import JSONResponse

app = FastAPI(title="Inconsistent business errors")


@app.post("/departments/legal/records")
def create_legal_record() -> dict[str, str]:
    return {"error": "duplicate reference"}


@app.post("/departments/procurement/records")
def create_procurement_record() -> None:
    raise HTTPException(status_code=400, detail={"reason": "already used"})


@app.post("/departments/human-resources/records")
def create_human_resources_record() -> JSONResponse:
    return JSONResponse(status_code=409, content={"message": "Conflict"})


# TODO: define one stable public envelope and one translation path.
# Do not expose implementation details or parse human prose in a client.
