public static boolean isValidTransition(RemoteLogSegmentState srcState, RemoteLogSegmentState targetState) {
        Objects.requireNonNull(targetState, "targetState can not be null");

        if (srcState == null) {
            // If the source state is null, check the target state as the initial state viz COPY_SEGMENT_STARTED
            // This ensures simplicity here as we don't have to define one more type to represent the state 'null' like
            // COPY_SEGMENT_NOT_STARTED, have the null check by the caller and pass that state.
            return targetState == COPY_SEGMENT_STARTED;
        } else if (srcState == targetState) {
            // Self transition is treated as valid. This is to maintain the idempotency for the state in case of retries
            // or failover.
            return true;
        } else if (srcState == COPY_SEGMENT_STARTED) {
            return targetState == COPY_SEGMENT_FINISHED || targetState == DELETE_SEGMENT_STARTED;
        } else if (srcState == COPY_SEGMENT_FINISHED) {
            return targetState == DELETE_SEGMENT_STARTED;
        } else if (srcState == DELETE_SEGMENT_STARTED) {
            return targetState == DELETE_SEGMENT_FINISHED;
        } else {
            return false;
        }
    }
This state indicates that the segment is deleted successfully.
storage/api/src/main/java/org/apache/kafka/server/log/remote/storage/RemoteLogSegmentState.java