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

/**
 * Typed representation of a PDF document's page count.
 * <p>
 * This record provides type safety and semantic clarity, distinguishing page count
 * from other numeric values (character counts, file sizes, error codes, etc.).
 * <p>
 * Design principles:
 * <ul>
 *   <li>Validated: only positive page counts are allowed</li>
 *   <li>Type-safe: prevents confusion with other numeric metrics</li>
 *   <li>Self-documenting: {@code PdfPageCount} is clearer than naked {@code int}</li>
 *   <li>Future-extensible: can add validation rules per milestone without signature changes</li>
 * </ul>
 */
public record PdfPageCount(int value) {
    /**
     * Constructor with validation.
     * <p>
     * Ensures the page count is meaningful and valid.
     *
     * @param value must be &gt;= 1
     * @throws IllegalArgumentException if value &lt; 1
     */
    public PdfPageCount {
        if (value < 1) {
            throw new IllegalArgumentException("Page count must be >= 1, but got: " + value);
        }
    }

    /**
     * Returns whether this page count exceeds a given limit.
     * <p>
     * Convenience method for page limit checks in later milestones.
     *
     * @param limit the maximum allowed page count
     * @return true if this count exceeds the limit
     */
    public boolean exceedsLimit(int limit) {
        return this.value > limit;
    }
}
