class PodTerminalGcController extends BaseGcController<V1Pod> {

    @VisibleForTesting
    boolean isPodTerminal(V1Pod pod, Map<String, Task> currentTasks) {
        String podName = KubeUtil.getMetadataName(pod.getMetadata());
        Task task = currentTasks.get(podName);
        if (task != null) {
            if (TaskState.isTerminalState(task.getStatus().getState())) {
                return clock.isPast(task.getStatus().getTimestamp() + kubeControllerConfiguration.getPodTerminalGracePeriodMs());
            }
            return false;
        }

        V1PodStatus status = pod.getStatus();
        if (status != null && KubeUtil.isPodPhaseTerminal(status.getPhase())) {
            return KubeUtil.findFinishedTimestamp(pod)
                    .map(timestamp -> clock.isPast(timestamp + kubeControllerConfiguration.getPodTerminalGracePeriodMs()))
                    .orElse(true);
        }
        return false;
    }

    @Inject public  PodTerminalGcController(
            TitusRuntime titusRuntime,
            LocalScheduler scheduler,
            @Named(POD_TERMINAL_GC_CONTROLLER) FixedIntervalTokenBucketConfiguration tokenBucketConfiguration,
            @Named(POD_TERMINAL_GC_CONTROLLER) ControllerConfiguration controllerConfiguration,
            KubeApiFacade kubeApiFacade,
            KubeControllerConfiguration kubeControllerConfiguration,
            V3JobOperations v3JobOperations
    );

}