package cn.axzo.msg.center.message.service.todo.card;

import cn.axzo.msg.center.MsgCenterApplication;
import cn.axzo.msg.center.api.mq.CardPresetButtonPressedMessage;
import com.alibaba.fastjson.JSON;
import lombok.RequiredArgsConstructor;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
/**
 * @author yanglin
 */
@SpringBootTest(classes = MsgCenterApplication.class)
@RequiredArgsConstructor(onConstructor_ = @Autowired)
class TodoSyncCardServiceTest {

    private final TodoSyncCardService todoSyncCardService;

    @Test
    void syncCardPresetButtonPressed() {
        String json = "{\"cardInfo\": {\"appCode\": \"msg-center:todo\", \"batchNo\": \"fd301a68203a430cbc6e6928c0164fe5\", \"bizCode\": \"test-14\", \"bizMessageId\": \"2e1119e4a96345049870558d53939700\", \"bizParam\": {\"assistLogName\": \"测试\", \"extInfo\": {\"todoType\": \"EXECUTABLE\", \"todoCategory\": \"OTHER\", \"todoPromoterWorkspaceId\": 0, \"todoIdentityCode\": \"80978834809443febcf579b0eecf560b\", \"todoExecutorWorkspaceId\": 0}}, \"buttonStates\": [{\"buttonCode\": \"f6a77000fc50487ab9be215201bf233a\", \"isActionPerformed\": true}], \"cardContent\": {\"bizCode\": \"test-14\", \"cardStyleCode\": \"common_style_001\", \"updateTime\": 1737025348622, \"cardContent\": \"系统提示，无需关注\", \"debugInfo\": {\"isUpdatable\": true, \"bizCode\": \"test-14\", \"bizState\": \"AGREED\", \"subBizCode\": \"aaaa\", \"cardState\": \"COMPLETED\"}, \"templateCode\": \"7aceab1f31ec4570a98cdaf7f8940c61\", \"sendTimestamp\": 1737025348622, \"cardTitle\": \"系统提示\", \"extInfo\": {\"todoType\": \"EXECUTABLE\", \"todoCategory\": \"OTHER\", \"todoPromoterWorkspaceId\": 0, \"todoIdentityCode\": \"80978834809443febcf579b0eecf560b\", \"todoExecutorWorkspaceId\": 0}, \"cardBannerUrl\": \"\", \"subBizCode\": \"aaaa\", \"stateImage\": \"https://axzo-public.oss-cn-chengdu.aliyuncs.com/msg-center/todo_card_state/card_biz_state_agreed_20241220.png\", \"cardButtons\": [{\"presetButtonType\": \"AGREE\", \"actionPerformed\": true, \"senderShow\": false, \"buttonCode\": \"f6a77000fc50487ab9be215201bf233a\", \"isHighlight\": true, \"action\": \"PRESET_BUTTON\", \"source\": \"CUSTOM\", \"title\": \"已同意\", \"executorShow\": true}]}, \"content\": \"系统提示，无需关注\", \"id\": 167756, \"identityCode\": \"726de22e936c4f3bb640693e5f2c0968\", \"imTaskId\": 756527, \"isSenderRobot\": \"YES\", \"receiverAppType\": \"CMP\", \"receiverOuId\": 10616, \"receiverPersonId\": 9000399522, \"receiverWorkspaceId\": 0, \"routerParam\": {}, \"senderAppType\": \"SYSTEM\", \"senderOuId\": 0, \"senderPersonId\": 6678911, \"senderWorkspaceId\": 0, \"state\": null, \"subBizCode\": \"aaaa\", \"subtitle\": \"\", \"templateCode\": \"7aceab1f31ec4570a98cdaf7f8940c61\", \"title\": \"系统提示\"}, \"messageId\": \"490ddb1e-5879-4088-bbda-7ca8f15bd4f2\", \"messageSendTime\": 1737025348697, \"messageSendTimeStr\": \"2025-01-16 19:02:28\", \"operatorId\": 9000399522, \"operatorName\": \"罗福\", \"presetButtonType\": \"AGREE\"}";
        CardPresetButtonPressedMessage message = JSON.parseObject(json, CardPresetButtonPressedMessage.class);
        todoSyncCardService.syncCardPresetButtonPressed(message);
    }

}