package org.raddatz.familienarchiv.geschichte;

import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
import java.util.UUID;

/**
 * List-projection for the /api/geschichten grid. Never carries items — avoids
 * LazyInitializationException (open-in-view: false) and prevents Cartesian joins.
 * Mirrors the PersonSummaryDTO precedent.
 *
 * <p>Field set: exactly what the live grid card renders (title, author byline, body excerpt,
 * publishedAt, status, type). Does NOT carry items or persons.
 */
public interface GeschichteSummary {

    @Schema(requiredMode = Schema.RequiredMode.REQUIRED)
    UUID getId();

    @Schema(requiredMode = Schema.RequiredMode.REQUIRED)
    String getTitle();

    @Schema(requiredMode = Schema.RequiredMode.REQUIRED)
    GeschichteStatus getStatus();

    @Schema(requiredMode = Schema.RequiredMode.REQUIRED)
    GeschichteType getType();

    /** Nested closed projection — exposes only the fields the grid card needs. */
    AuthorSummary getAuthor();

    LocalDateTime getPublishedAt();

    /** Always set (@UpdateTimestamp) — drives "bearbeitet vor X" on dashboard cards. */
    @Schema(requiredMode = Schema.RequiredMode.REQUIRED)
    LocalDateTime getUpdatedAt();

    String getBody();

    /** Author projection — names only; never email or group memberships (same rule as GeschichteView.AuthorView). */
    interface AuthorSummary {
        String getFirstName();
        String getLastName();
    }
}
