package com.yuchen.saas.message.api.feign.message;

import com.yuchen.saas.message.api.dto.PmgBatMessageDto;
import com.yuchen.saas.message.api.dto.PmgBatMessageQueryDto;
import com.yuchen.saas.message.api.vo.PmgBatMessageVo;
import org.nest.springwrap.core.launch.app.AppNameConstant;
import org.nest.springwrap.core.mp.support.NestPage;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * <p>
 * 消息中心feign调用
 * </p>
 *
 * @author caiwq
 * @since 2024-02-28
 */
@FeignClient(
        value = AppNameConstant.SAAS_MESSAGE,
        fallbackFactory = MessageFeignFallback.class
)
public interface MessageFeignServer {

    /**
     * 添加消息
     * @param messageDto 消息Dto
     * @return TRUE/FALSE
     */
    @PostMapping("/message/saveMessage")
    R<Boolean> saveMessage(@RequestBody @Validated PmgBatMessageDto messageDto);

    /**
     * 批量添加消息
     * @param messageList 消息Dto
     * @return TRUE/FALSE
     */
    @PostMapping("/saveBatchMessage")
    R<Boolean> saveBatchMessage(@RequestBody List<PmgBatMessageDto> messageList);

    /**
     * 删除消息
     * @param id 消息ID
     * @return TRUE/FALSE
     */
    @DeleteMapping("/message/deleteMessage/{id}")
    R<Boolean> deleteMessage(@PathVariable("id") Long id);

    /**
     * 消息列表(分页)
     * @param queryDto 消息列表查询参数
     * @return 消息列表Vo
     */
    @PostMapping("/message/getMessagePageList")
    R<NestPage<PmgBatMessageVo>> getMessagePageList(@RequestBody PmgBatMessageQueryDto queryDto);

}
