package de.gecheckt.pdf.umbenenner.domain.model;

import java.util.Objects;

/**
 * Unvalidated, uninterpreted raw response body from an AI service.
 * <p>
 * This record holds the exact bytes or string returned by the AI HTTP endpoint,
 * before any parsing, validation, or business-logic processing. It is used to:
 * <ul>
 *   <li>Preserve the original response for audit and debugging purposes.</li>
 *   <li>Separate the technical success of the HTTP call from the semantic validity
 *       of the response content.</li>
 *   <li>Enable deterministic retry decisions: a 200 OK response is a technical success
 *       even if the JSON is unparseable or semantically invalid.</li>
 * </ul>
 * <p>
 * <strong>Persistance:</strong> The raw response is stored in SQLite history for
 * traceability and future debugging. It may contain the full JSON structure or
 * formatted text, depending on the AI service.
 * <p>
 * <strong>Example:</strong>
 * <pre>
 * {@code
 * AiRawResponse response = new AiRawResponse(
 *     "{\"date\": \"2026-03-05\", \"title\": \"Stromabrechnung\", \"reasoning\": \"...\"}"
 * );
 * }
 * </pre>
 *
 * @param content the raw response body as a string (non-null, may be empty or malformed)
 */
public record AiRawResponse(String content) {

    /**
     * Compact constructor validating that content is not null.
     *
     * @throws NullPointerException if {@code content} is null
     */
    public AiRawResponse {
        Objects.requireNonNull(content, "content must not be null");
    }
}
