package com.fantaibao.iot.infrastructure.service.recording;

import com.fantaibao.iot.domain.constant.RecordingTodoConstants;
import org.springframework.data.redis.core.StringRedisTemplate;

/**
 * 精简自业务仓 RecordingTodoDomainServiceImpl#replaceText：
 * 将待办原文 content/title（纯 String）写入 StringRedisTemplate，无 JSON 序列化。
 * 对应企微误报：类型 &lt;未解析&gt;、value 新增为 “{}”。
 */
public class RecordingTodoDomainServiceImpl {

    private StringRedisTemplate stringRedisTemplate;

    public void replaceText(String tenantId, String todoId, String originalContent, String originalTitle) {
        String contentRedisKey = RecordingTodoConstants.REDIS_KEY_PREFIX + todoId + ":" + tenantId;
        stringRedisTemplate.opsForValue().set(contentRedisKey, originalContent);

        String titleRedisKey = RecordingTodoConstants.REDIS_KEY_PREFIX + "title:" + todoId + ":" + tenantId;
        stringRedisTemplate.opsForValue().set(titleRedisKey, originalTitle);
    }
}
