package com.ssyf.feign.application.message;

import com.ssyf.common.core.domain.query.ListQuery;
import com.ssyf.common.domain.message.query.MessageQuery;
import com.ssyf.common.web.result.Result;
import com.ssyf.feign.config.FeignConfiguration;
import com.ssyf.feign.fallback.MessageFeignFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


/**
 * 消息微服务
 * @author huwei
 * @date 2023/9/27 11:25
 */
@FeignClient(name = "message" ,path = "/message" ,contextId = "message",configuration = FeignConfiguration.class ,fallback = MessageFeignFallback.class)
public interface MessageFeignService {


    /**
     * 添加数据
     * @param query
     * @return
     */
    @RequestMapping(value = "/api/message/addOne" ,method = RequestMethod.POST ,consumes = MediaType.APPLICATION_JSON_VALUE)
    Result sendMessage( @RequestBody MessageQuery query);

    /**
     * 批量添加数据
     * @param query
     * @return
     */
    @RequestMapping(value = "/api/message/addBatch" ,method = RequestMethod.POST ,consumes = MediaType.APPLICATION_JSON_VALUE)
    Result addBatch(@RequestBody ListQuery<MessageQuery> query);

    /**
     * 更新为处理中
     * @param uid
     * @return
     */
    @RequestMapping(value = "/api/message/updateProcessed/{uid}" ,method = RequestMethod.POST ,consumes = MediaType.APPLICATION_JSON_VALUE)
    Result updateProcessed(@PathVariable String uid);

    /**
     * 更新为完成
     * @param uid
     * @return
     */
    @RequestMapping(value = "/api/message/updateComplete/{uid}" ,method = RequestMethod.POST ,consumes = MediaType.APPLICATION_JSON_VALUE)
    Result updateComplete(@PathVariable String uid);

    /**
     * 删除指定数据
     * @param uid
     * @return
     */
    @RequestMapping(value = "/api/message/remove/{uid}" ,method = RequestMethod.POST ,consumes = MediaType.APPLICATION_JSON_VALUE)
    Result remove(@PathVariable String uid);
}
