package com.bonus.system.api;

import com.bonus.common.core.constant.SecurityConstants;
import com.bonus.common.core.constant.ServiceNameConstants;
import com.bonus.common.core.domain.R;
import com.bonus.system.api.domain.SysFileSource;
import com.bonus.system.api.domain.SysOperLog;
import com.bonus.system.api.factory.RemoteUserFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;

@FeignClient(contextId = "remoteSourceService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
public interface RemoteSourceService {

    /**
     * 保存资源信息
     * @param sysFileSource
     * @param source
     * @return
     * @throws Exception
     */
    @PostMapping("/fileSource/addFileSource")
    public R<Boolean> addFileSource(@RequestBody SysFileSource sysFileSource, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;

    /**
     * 保存资源信息
     * @param sysFileSource
     * 优先按照id 去删除
     * 如果没有id 则
     * 按照资源id去删除
     * @param source
     * @return
     * @throws Exception
     */
    @PostMapping("/fileSource/delSourceFile")
    public R<Boolean> delSourceFile(@RequestBody SysFileSource sysFileSource, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;


    /**
     * 查询文件资源信息
     * @param sourceId
     * @param source
     * @return
     * @throws Exception
     */
    @PostMapping("/fileSource/getSourceFileList")
    public R<List<SysFileSource>> getSourceFileList(@RequestBody String sourceId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;

}
