package com.crm.manager.service;

import com.crm.manager.configuration.FeignMultipartSupportConfig;
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.market.upload.email.MarketUploadEmailListDto;
import com.crm.rely.backend.core.dto.market.upload.email.detail.MarketUploadEmailDetailListDto;
import com.crm.rely.backend.core.entity.base.SingleLongEntity;
import com.crm.rely.backend.core.entity.custom.info.InfoEntity;
import com.crm.rely.backend.core.entity.market.email.upload.MarketUploadEmailDeleteEntity;
import com.crm.rely.backend.core.entity.market.email.upload.MarketUploadEmailSearchPageEntity;
import com.crm.rely.backend.core.entity.market.email.upload.detail.MarketUploadEmailDetailDeleteEntity;
import com.crm.rely.backend.core.entity.market.email.upload.detail.MarketUploadEmailDetailSearchPageEntity;
import com.crm.rely.backend.core.entity.market.email.upload.detail.MarketUploadEmailDetailUpdateEntity;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

/**
 * @description:
 * @author: houn
 * @create: 2021-07-21 16:25
 **/
@FeignClient(name = "MARKETS-SERVICE", path = "/market/upload/email", configuration = FeignMultipartSupportConfig.class)
public interface MarketUploadEmailFeignService {

    @PostMapping(value = "/add", produces = {MediaType.APPLICATION_JSON_UTF8_VALUE}, consumes =
            MediaType.MULTIPART_FORM_DATA_VALUE)
    BaseResultDto add( @RequestPart(value = "file", required = false) MultipartFile file,
                       @RequestParam(value = "name") String name) throws Exception;

    /**
     * 查看上传列表
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/search/list")
    ResultWithPagerDto<MarketUploadEmailListDto> pageList(@RequestBody @Validated MarketUploadEmailSearchPageEntity entity) throws Exception;

    /**
     * 查看单个上传列表记录
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/search/single")
    BaseResultDto<MarketUploadEmailListDto> single(@RequestBody @Validated SingleLongEntity entity) throws Exception;

    /**
     * 查看详情列表
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/search/list/detail")
    ResultWithPagerDto<MarketUploadEmailDetailListDto> pageListDetail(@RequestBody @Validated MarketUploadEmailDetailSearchPageEntity entity) throws Exception;

    /**
     * 查看详情的单个记录条数
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/search/single/detail")
    BaseResultDto<MarketUploadEmailDetailListDto> singleDetail(@RequestBody @Validated SingleLongEntity entity) throws Exception;

    /**
     * 修改详情的内容
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/update/detail")
    BaseResultDto updateDetail(@RequestBody @Validated MarketUploadEmailDetailUpdateEntity entity) throws Exception;

    /**
     * 删除删除列表
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/delete")
    BaseResultDto delete(@RequestBody @Validated MarketUploadEmailDeleteEntity entity) throws Exception;

    /**
     * 删除详情记录
     *
     * @param entity
     * @return
     * @throws Exception
     */
    @PostMapping("/delete/detail")
    BaseResultDto deleteDetail(@RequestBody @Validated MarketUploadEmailDetailDeleteEntity entity) throws Exception;

    @GetMapping("/template/export")
    byte[]  templateExport() throws Exception;
}
