package com.crm.manager.service.ucard;

import com.crm.rely.backend.core.dto.base.BaseResultDto;
import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
import com.crm.rely.backend.core.dto.ucard.CardFileDto;
import com.crm.rely.backend.core.entity.base.BaseDeleteEntities;
import com.crm.rely.backend.core.entity.ucard.CardFileAddEntity;
import com.crm.rely.backend.core.entity.ucard.CardFilePageEntity;
import com.crm.rely.backend.core.entity.ucard.CardFileUpdateEntity;
import com.crm.rely.backend.exception.ServiceException;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

@FeignClient(name = "UCARD-SERVICE", path = "/ucard/file/manager")
public interface UcardFileFeignService {

    /**
     * 添加文件记录
     */
    @PostMapping("/add")
    BaseResultDto cardFileAdd(CardFileAddEntity entity) throws ServiceException;

    /**
     * 校验文件
     */
    @PostMapping(value = "/validated/file", produces = {MediaType.APPLICATION_JSON_UTF8_VALUE}, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    void validatedFile(@RequestPart(value = "file") MultipartFile file) throws ServiceException;

    /**
     * 修改文件
     */
    @PostMapping("/update")
    BaseResultDto cardFileUpdate(CardFileUpdateEntity entity) throws ServiceException;

    /**
     * 删除文件
     */
    @PostMapping("/delete")
    BaseResultDto cardFileDelete(BaseDeleteEntities entity) throws ServiceException;

    /**
     * 文件分页列表
     */
    @PostMapping("/search/list")
    ResultWithPagerDto<CardFileDto> cardFileSearchList(CardFilePageEntity entity) throws ServiceException;


}
