class ExtendedJobSanitizer implements EntitySanitizer {

    @Override
    public <T> Optional<T> sanitize(T entity) {
        T sanitized = entitySanitizer.sanitize(entity).orElse(entity);

        if (sanitized instanceof com.netflix.titus.api.jobmanager.model.job.JobDescriptor) {
            sanitized = (T) sanitizeJobDescriptor((JobDescriptor) sanitized);
        }

        return entity == sanitized ? Optional.empty() : Optional.of(sanitized);
    }

    public  ExtendedJobSanitizer(JobManagerConfiguration jobManagerConfiguration,
                                JobAssertions jobAssertions,
                                @Named(JOB_STRICT_SANITIZER) EntitySanitizer entitySanitizer,
                                DisruptionBudgetSanitizer disruptionBudgetSanitizer,
                                @Named(SECURITY_GROUPS_REQUIRED_FEATURE) Predicate<JobDescriptor> securityGroupsRequiredPredicate,
                                @Named(ENVIRONMENT_VARIABLE_NAMES_STRICT_VALIDATION_FEATURE) Predicate<JobDescriptor> environmentVariableNamesStrictValidationPredicate,
                                TitusRuntime titusRuntime);

}