package com.weaver.seconddev.interfaces.prop;

import com.weaver.common.base.entity.result.WeaResult;
import com.weaver.mc.api.async.AsyncSystemMessageRest;
import com.weaver.mc.api.entity.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.*;

@Component
public class MessageUtil {
    @Autowired
    private AsyncSystemMessageRest systemMessageRest;


    private static final long EMPLOYEE_ID = 3905800511444409505L;
    private static final String TENANT_KEY = "ty0tu018gk";

    private static final UserEntity DEFAULT_RECIVER = new UserEntity(EMPLOYEE_ID).setTenantKey(TENANT_KEY);


    /**
     * 基本消息
     *
     * @returnxit
     */
    private SendMessageEntity getBaseMsg() {
        SendMessageEntity smg = new SendMessageEntity();
        smg.setModule(MessageModule.TASK);
        smg.setEvent(MessageEvent.NOTIFY);
        smg.setSender(UserEntity.SYSTEM_USER);
        smg.setReceivers(Collections.singletonList(DEFAULT_RECIVER));
        smg.setText("任务提醒");
        smg.setPcUrl(" 云桥pc打开事项地址");//可以为空
        smg.setAppUrl("云桥app打开事项地址");//可以为空
        smg.setTitle("云桥任务提醒标题");
        smg.setContent("云桥消息内容");
        return smg;
    }


    private void sendMes(SendMessageEntity smg){
        WeaResult<Long> longWeaResult = systemMessageRest.sendMsg(smg);

    }


}
