I have this class:
package com.manomano.catalog.pim.product.projection.application

import com.manomano.catalog.pim.product.projection.domain.MasterProductId
import com.manomano.catalog.pim.product.projection.domain.MasterProductIdPreset
import com.manomano.catalog.pim.product.projection.domain.Mmid
import com.manomano.catalog.pim.product.projection.domain.MmidPreset
import com.manomano.catalog.pim.product.projection.domain.PresetType
import com.manomano.catalog.pim.product.projection.domain.ProductPresetsRepository
import org.springframework.stereotype.Component
import java.io.InputStream
import java.util.UUID

const val MAX_PRESETS_PER_USER = 10

@Component
class UploadPresetFile(
    private val productPresetRepository: ProductPresetsRepository,
) {
    fun execute(fileName: String, fileContent: InputStream, userId: UUID, type: PresetType): UploadPresetFileResult {
        if (productPresetRepository.countUserPresets(userId) >= MAX_PRESETS_PER_USER) {
            return UploadPresetFileResult.TooManyPresets
        }

        return when (type) {
            PresetType.MMID -> {
                when (val validationResult = fileContent.toValidPreset(
                    ::Mmid
                )) {
                    is PresetValidationResult.Success<Mmid> -> {
                        val preset = MmidPreset(fileName, validationResult.ids)
                        UploadPresetFileResult.Success(productPresetRepository.saveMmidPreset(preset, userId))
                    }

                    is PresetValidationResult.Failure -> UploadPresetFileResult.InvalidContent(validationResult.errors)
                    is PresetValidationResult.Emptyfile -> UploadPresetFileResult.EmptyFile
                }
            }

            PresetType.MASTER_PRODUCT_ID -> {
                when (val validationResult = fileContent.toValidPreset(
                    ::MasterProductId
                )) {
                    is PresetValidationResult.Success<MasterProductId> -> {
                        val preset = MasterProductIdPreset(fileName, validationResult.ids)
                        UploadPresetFileResult.Success(productPresetRepository.saveMasterProductIdPreset(preset, userId))
                    }

                    is PresetValidationResult.Failure -> UploadPresetFileResult.InvalidContent(validationResult.errors)
                    is PresetValidationResult.Emptyfile -> UploadPresetFileResult.EmptyFile
                }
            }
        }
    }

    fun <T> InputStream.toValidPreset(
        idCreator: (Long) -> T
    ): PresetValidationResult<T> {

        val errors = mutableListOf<ErrorLine>()
        val ids = mutableSetOf<T>()

        bufferedReader().use { reader ->
            reader.lineSequence().forEachIndexed { index, line ->
                if (line.isNotBlank()) {
                    val idValue = line.toLongOrNull()
                    if (idValue == null) {
                        if (index > 0) {
                            errors += ErrorLine(index + 1, ValidationError.INVALID_ID)
                        }
                    } else {
                        ids += idCreator(idValue)
                    }
                }
            }
        }

        if (ids.isEmpty() && errors.isEmpty()) {
            return PresetValidationResult.Emptyfile("Empty file")
        }

        return if (errors.isNotEmpty()) {
            PresetValidationResult.Failure(errors)
        } else {
            PresetValidationResult.Success(ids)
        }
    }
}

sealed class UploadPresetFileResult {
    data class Success(val presetId: UUID) : UploadPresetFileResult()
    data object TooManyPresets: UploadPresetFileResult()
    data object EmptyFile: UploadPresetFileResult()
    data class InvalidContent(val errors: List<ErrorLine>?) : UploadPresetFileResult()
}

data class ErrorLine(val line: Int, val error: ValidationError)

sealed class PresetValidationResult<T> {
    data class Success<T>(val ids: Set<T>) : PresetValidationResult<T>()
    data class Failure<T>(val errors: List<ErrorLine>) : PresetValidationResult<T>()
    data class Emptyfile<T>(val toto: String): PresetValidationResult<T>()
}



enum class ValidationError {
    INVALID_ID
}

It works but the val toto: String is useless on Emptyfile, how to make it work without this ?