class FinalPodPhaseInfo {

    public static FinalPodPhaseInfo fromPodStatus(String podName, PodStatus status)
    {
        int exitCode = DEFAULT_EXIT_CODE;

        Optional<ContainerStatus> containerStatus = status.getContainerStatuses().stream()
            .filter(cs -> cs.getState() != null && cs.getState().getTerminated() != null)
            .findFirst();

        // normal operation completion
        if(containerStatus.isPresent())
            exitCode = containerStatus.get().getState().getTerminated().getExitCode();
        // else (nothing special, likely a fail -- observed out of cpu)

        return new FinalPodPhaseInfo(podName, PodPhase.fromPodStatus(status), exitCode, status.getReason());
    }

    public  FinalPodPhaseInfo(String podName, PodPhase podPhase, int exitCode, String reason);

}