package cloud.nstart.terravault.ordinis.restapi.dto.draft;

import cloud.nstart.terravault.ordinis.domain.draft.DraftOperation;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.JsonNode;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

import java.time.OffsetDateTime;

/**
 * Maker submits a proposed change. Approval workflow v2 (D2=A: legacy POST на
 * approval-required dict вернёт 409 с hint'ом use this endpoint).
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public record SubmitDraftRequest(
    @NotBlank String businessKey,
    @NotNull DraftOperation operation,
    /** CREATE/UPDATE: новый payload. CLOSE: null OK. */
    JsonNode data,
    String geometryWkt,
    OffsetDateTime validFrom,
    OffsetDateTime validTo,
    /** Optional maker note. */
    String comment) {}
