package org.raddatz.familienarchiv.person.relationship.dto;

import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import org.raddatz.familienarchiv.document.DatePrecision;
import org.raddatz.familienarchiv.person.relationship.RelationType;

import java.time.LocalDate;
import java.util.UUID;

/**
 * Request body for both creating and updating a relationship — the fields are
 * identical, so one record serves {@code POST} and {@code PUT} (DRY). A null
 * {@code *DatePrecision} is normalized to {@code UNKNOWN} by the service; the
 * service then enforces coherence (date ⇔ non-UNKNOWN precision) and order
 * (fromDate ≤ toDate).
 */
public record RelationshipUpsertRequest(
        @NotNull UUID relatedPersonId,
        @NotNull RelationType relationType,
        LocalDate fromDate,
        DatePrecision fromDatePrecision,
        LocalDate toDate,
        DatePrecision toDatePrecision,
        @Size(max = 2000) String notes
) {}
