from __future__ import annotations

from core.http.response import ProblemDetails, build_problem_details


def test_problem_details_defaults() -> None:
    result = build_problem_details(status_code=401, detail="Unauthorized")

    assert isinstance(result, ProblemDetails)
    assert result.type == "about:blank"
    assert result.title == "Unauthorized"
    assert result.status == 401
    assert result.detail == "Unauthorized"
    assert result.instance is None


def test_problem_details_overrides() -> None:
    result = build_problem_details(
        status_code=409,
        detail="Conflict",
        type_value="https://example.com/problems/conflict",
        title="Conflict",
        instance="/api/mobile/auth/signup",
    )

    assert result.type == "https://example.com/problems/conflict"
    assert result.title == "Conflict"
    assert result.status == 409
    assert result.detail == "Conflict"
    assert result.instance == "/api/mobile/auth/signup"
