package shop.alien.store.feign;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import shop.alien.entity.result.R;
import shop.alien.entity.store.LawFirm;
import shop.alien.entity.store.vo.LawFirmPaymentVO;

import org.springframework.http.ResponseEntity;
import java.util.List;

/**
 * 律师服务 Feign 客户端
 *
 * @author system
 * @since 2025-01-XX
 */
@FeignClient(name = "alien-lawyer", url = "${feign.alienLawyer.url:}")
public interface LawyerServiceFeign {

    @PostMapping("/lawyer/firm/addLawFirm")
    R<LawFirm> addLawFirm(@RequestBody LawFirm lawFirm);

    @PostMapping("/lawyer/firm/editLawFirm")
    R<LawFirm> editLawFirm(@RequestBody LawFirm lawFirm);

    @DeleteMapping("/lawyer/firm/deleteLawFirm")
    R<Boolean> deleteLawFirm(@RequestParam("id") Integer id);

    @GetMapping("/lawyer/firm/getList")
    R<List<LawFirm>> getList(@RequestParam(value = "id", required = false) Integer id,
                              @RequestParam(value = "firmName", required = false) String firmName,
                              @RequestParam(value = "creditCode", required = false) String creditCode,
                              @RequestParam(value = "status", required = false) Integer status,
                              @RequestParam(value = "certificationStatus", required = false) Integer certificationStatus,
                              @RequestParam(value = "province", required = false) String province,
                              @RequestParam(value = "city", required = false) String city,
                              @RequestParam(value = "createdTime_Start", required = false) String createdTime_Start,
                              @RequestParam(value = "createdTime_End", required = false) String createdTime_End);

    @GetMapping("/lawyer/firm/getPage")
    R<IPage<LawFirm>> getPage(@RequestParam(value = "page", defaultValue = "1") int page,
                               @RequestParam(value = "size", defaultValue = "10") int size,
                               @RequestParam(value = "id", required = false) Integer id,
                               @RequestParam(value = "firmName", required = false) String firmName,
                               @RequestParam(value = "creditCode", required = false) String creditCode,
                               @RequestParam(value = "status", required = false) Integer status,
                               @RequestParam(value = "createdTime_Start", required = false) String createdTime_Start,
                               @RequestParam(value = "createdTime_End", required = false) String createdTime_End);

    @GetMapping("/lawyer/firm/getDetail")
    R<LawFirm> getLawFirmDetail(@RequestParam("id") Integer id);

    @GetMapping("/lawyer/firm/export")
    ResponseEntity<byte[]> exportLawFirm();

    @PostMapping(value = "/lawyer/firm/import", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    R<String> importLawFirm(@RequestPart("file") MultipartFile file);

    @GetMapping("/lawyer/firm/downloadTemplate")
    ResponseEntity<byte[]> downloadTemplate();

    @GetMapping("/lawyer/firm/getPaymentPageWithFirm")
    R<IPage<LawFirmPaymentVO>> getPaymentPageWithFirm(
            @RequestParam(value = "page", defaultValue = "1") int page,
            @RequestParam(value = "size", defaultValue = "10") int size,
            @RequestParam(value = "firmId", required = false) Integer firmId,
            @RequestParam(value = "paymentAccount", required = false) String paymentAccount,
            @RequestParam(value = "firmName", required = false) String firmName,
            @RequestParam(value = "creditCode", required = false) String creditCode,
            @RequestParam(value = "status", required = false) Integer status,
            @RequestParam(value = "certificationStatus", required = false) Integer certificationStatus,
            @RequestParam(value = "directorName", required = false) String directorName,
            @RequestParam(value = "createdTimeStart", required = false) String createdTimeStart,
            @RequestParam(value = "createdTimeEnd", required = false) String createdTimeEnd);
}

