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

import com.fasterxml.jackson.annotation.JsonInclude;
import jakarta.validation.constraints.NotNull;

/**
 * Reviewer's decision for a draft in REVIEW_PENDING.
 *
 * <p>Endpoint: {@code POST /api/v1/dictionaries/{name}/drafts/{draftId}/decision}.
 *
 * <p>Transitions:
 * <ul>
 *   <li>{@link Verdict#APPROVE} → status=APPROVED, ждёт publish.</li>
 *   <li>{@link Verdict#REQUEST_CHANGES} → status=CHANGES_REQUESTED, maker
 *       должен доработать и re-submit.</li>
 *   <li>{@link Verdict#REJECT} → status=REJECTED (terminal).</li>
 * </ul>
 *
 * <p>Self-approve forbidden: backend проверяет maker_id != decision_user_id.
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public record DecisionRequest(
    @NotNull Verdict decision,
    String comment) {

  public enum Verdict {
    APPROVE,
    REQUEST_CHANGES,
    REJECT
  }
}
