package com.cloudhandson.ddsbackoffice.domain;

import java.util.List;

/** Preview of the effective application permissions compiled to DDS grants. */
public record DdsProvisioningPlan(
    List<DdsGrantPlan> grants,
    List<String> warnings,
    int mappedUserCount
) {

  public DdsProvisioningPlan {
    grants = grants == null ? List.of() : List.copyOf(grants);
    warnings = warnings == null ? List.of() : List.copyOf(warnings);
  }

  public long publishableCount() {
    return grants.stream().filter(DdsGrantPlan::publishable).count();
  }

  public boolean hasWarnings() {
    return !warnings.isEmpty();
  }
}
