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

import java.util.Objects;

/**
 * Represents successful parsing of an AI response into its JSON structure.
 * <p>
 * The response body was parsed as JSON, the expected fields (title, reasoning, optional date)
 * were extracted, and are now available for semantic validation.
 * <p>
 * <strong>Field semantics:</strong>
 * <ul>
 *   <li>{@link #response()} — the parsed response with title, reasoning, and optional date
 *       as string values. Not yet semantically validated.</li>
 * </ul>
 * <p>
 * <strong>Next step:</strong> Semantic validation of the parsed fields (title length,
 * date format, etc.) is performed separately, in the Application layer. This separation
 * allows precise error classification: parse failures are technical, validation failures
 * are functional/deterministic.
 *
 * @param response the parsed response structure; never null
 */
public record AiResponseParsingSuccess(
        ParsedAiResponse response) implements AiResponseParsingResult {

    /**
     * Compact constructor validating the response field.
     *
     * @throws NullPointerException if response is null
     */
    public AiResponseParsingSuccess {
        Objects.requireNonNull(response, "response must not be null");
    }
}
