package com.cloudhandson.ddsbackoffice.domain;

import java.util.List;

/** Dashboard model separated into the product service path and advanced direct comparison. */
public record DdsProtectionOverview(
    DdsProtectionPathStatus servicePath,
    List<DdsProtectionPathStatus> directPaths
) {

  public DdsProtectionOverview {
    directPaths = directPaths == null ? List.of() : List.copyOf(directPaths);
  }

  public int actionRequiredCount() {
    int serviceActions = servicePath != null && servicePath.needsAction() ? 1 : 0;
    return serviceActions + (int) directPaths.stream().filter(DdsProtectionPathStatus::needsAction).count();
  }
}
