package com.cloudhandson.ddsbackoffice.domain;

import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;

/** One protected-object status for one enforcement path, safe for the operator UI. */
public record DdsProtectionPathStatus(
    String pathKey,
    String pathLabel,
    String subjectLabel,
    String objectName,
    boolean advanced,
    String primaryLabel,
    String primaryTone,
    String primaryDescription,
    String observationLabel,
    String observationDetail,
    String synchronizationLabel,
    String synchronizationDetail,
    String verificationLabel,
    String verificationDetail,
    Instant observedAt,
    String actionLabel,
    String actionHref
) {

  public boolean needsAction() {
    return "danger".equals(primaryTone);
  }

  public String observedAtLabel() {
    return DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm")
        .withZone(ZoneId.of("Asia/Seoul"))
        .format(observedAt);
  }
}
