package com.yaoyicloud.ai.pipeline.fc;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

import com.aliyun.fc.runtime.Context;
import com.aliyun.fc.runtime.PojoRequestHandler;

public class ImageDupCheckFeatureExtractHandler implements PojoRequestHandler<TaskContentMsgs, TaskContentMsgsWithFeature> {

	@Override
	public TaskContentMsgsWithFeature handleRequest(TaskContentMsgs request, Context context) {
		System.out.println("Fake Features, Create Real Feature Extract FC to replace this in test channel or prod");
		return new TaskContentMsgsWithFeature(
			request.getItems(),
			request.getIndexField(),
			request.getItems().stream()
				.map(msg -> IntStream.range(0, msg.getImgList().size()).mapToObj(i -> "base64_" + i).collect(Collectors.toList()))
				.flatMap(List::stream)
				.collect(Collectors.toList())
		);
	}

}
