package com.jwipc.sys.constant;

import com.alibaba.fastjson2.JSONObject;
import com.dtflys.forest.annotation.*;
import com.jwipc.log.annotation.ApiOperateLog;
import com.jwipc.log.constant.ApiDirection;
import com.jwipc.log.constant.ThirdSysType;
import com.jwipc.sys.dto.KingdeeImageApiResultDTO;

/**
 * <p>
 *  影像系统接口
 * </p>
 *
 * @author Chen Tianshi
 * @since 2025/10/13 16:38
 */
@BaseRequest(baseURL = "#{sys.kingdee.image.host}")
public interface SysKingdeeImageClient {

    /**
     * 获取影像系统Access Token
     */
    @Post(
            url = "/archivebase/scan/login/token",
            contentType = "application/json; charset=UTF-8"
    )
    @ApiOperateLog(
            code = "GetAccessToken",
            name = "获取影像Access Token",
            direction = ApiDirection.SRM_TO_OTHER,
            thirdSysType = ThirdSysType.INVOICE_CLOUD
    )
    KingdeeImageApiResultDTO getAccessToken(@Body JSONObject body);

    /**
     * 文件上传接口
     */
    @Post(
            url = "/imgsys/bill/outside/file/upload",
            contentType = "multipart/form-data; charset=utf-8"
    )
    @ApiOperateLog(
            code = "UploadFile",
            name = "影像系统文件上传",
            direction = ApiDirection.SRM_TO_OTHER,
            thirdSysType = ThirdSysType.IMAGE
    )
    KingdeeImageApiResultDTO uploadFile(@DataFile(value = "file", fileName = "${1}") byte[] bytes,
                                        String filename,
                                        @Body("hashType") String hashType,
                                        @Query("access_token") String token);

    /**
     * 获取单据影像明细
     */
    @Post(
            url = "/imgsys/bill/outside/scanbill/getInfo",
            contentType = "application/json; charset=UTF-8"
    )
    @ApiOperateLog(
            code = "GetBoundImageIdList",
            name = "获取单据影像明细",
            direction = ApiDirection.SRM_TO_OTHER,
            thirdSysType = ThirdSysType.IMAGE
    )
    KingdeeImageApiResultDTO getBoundImageIdList(@Body JSONObject body, @Query("access_token") String token);

    /**
     * 绑定单据影像关系
     */
    @Post(
            url = "/imgsys/bill/outside/scanbill/add",
            contentType = "application/json; charset=UTF-8"
    )
    @ApiOperateLog(
            code = "BindingImageRelation",
            name = "绑定单据影像关系",
            direction = ApiDirection.SRM_TO_OTHER,
            thirdSysType = ThirdSysType.IMAGE
    )
    KingdeeImageApiResultDTO bindingImageRelation(@Body JSONObject body, @Query("access_token") String token);

    /**
     * 删除影像（整单删除）
     */
    @Post(
            url = "/imgsys/bill/outside/delete",
            contentType = "application/json; charset=UTF-8"
    )
    @ApiOperateLog(
            code = "DeleteBillImage",
            name = "删除影像（整单删除）",
            direction = ApiDirection.SRM_TO_OTHER,
            thirdSysType = ThirdSysType.IMAGE
    )
    KingdeeImageApiResultDTO deleteBillImage(@Body JSONObject body, @Query("access_token") String token);

    /**
     * 删除影像
     */
    @Post(
            url = "/imgsys/bill/outside/scanbill/delete",
            contentType = "application/json; charset=UTF-8"
    )
    @ApiOperateLog(
            code = "DeleteImage",
            name = "删除影像",
            direction = ApiDirection.SRM_TO_OTHER,
            thirdSysType = ThirdSysType.IMAGE
    )
    KingdeeImageApiResultDTO deleteImage(@Body JSONObject body, @Query("access_token") String token);

    /**
     * 获取影像查看页面地址
     */
    @Post(
            url = "/imgsys/bill/outside/getScanUrl",
            contentType = "application/json; charset=UTF-8"
    )
    @ApiOperateLog(
            code = "GetImageViewPath",
            name = "获取影像查看页面地址",
            direction = ApiDirection.SRM_TO_OTHER,
            thirdSysType = ThirdSysType.IMAGE
    )
    KingdeeImageApiResultDTO getImageViewPath(@Body JSONObject body, @Query("access_token") String token);
}
