package jnpf.certificate;

import jnpf.base.ActionResult;
import jnpf.certificate.fallback.CertificateManageFallbackApi;
import jnpf.model.certificate.vo.CertificateOrganizeBusinessLicenseVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import java.util.Collection;
import java.util.List;

@FeignClient(name = "jnpf-ftb", fallback = CertificateManageFallbackApi.class, path = "/web/certificate-manage-api")
public interface CertificateManageApi {

    /**
     * 根据组织ID查询营业执照信息。
     *
     * @param organizeId 组织ID
     * @return 营业执照信息
     */
    @GetMapping("/query-business-license")
    ActionResult<CertificateOrganizeBusinessLicenseVO> queryBusinessLicense(@RequestParam("organizeId") String organizeId);

    /**
     * 根据组织ID列表批量查询营业执照信息。
     *
     * @param organizeIds 组织ID列表
     * @return 营业执照信息列表
     */
    @PostMapping("/query-business-license-batch")
    ActionResult<List<CertificateOrganizeBusinessLicenseVO>> queryBusinessLicenseBatch(@RequestBody Collection<String> organizeIds);

    /**
     * 保存组织营业执照信息。
     *
     * @param req 营业执照保存参数
     * @return 操作结果
     */
    @PostMapping("/save-business-license")
    ActionResult<Void> saveBusinessLicense(@Valid @RequestBody CertificateOrganizeBusinessLicenseVO req);

    /**
     * 根据组织ID删除该主体下全部证照信息。
     *
     * @param organizeId 组织ID
     * @param loginUserId 登录用户ID
     * @return 操作结果
     */
    @DeleteMapping("/delete-business-license")
    ActionResult<Void> deleteBusinessLicense(@RequestParam("organizeId") String organizeId,
                                             @RequestParam(value = "loginUserId", required = false) String loginUserId);
}
